Electron impact excitation studies of laser-excited and ground-state barium and ytterbium