Vibrational and rotational excitation of molecular ions by slow electrons