The excitation of emission lines in the spectra of early-type stars