Certain wavelengths of light will cause the electrons to oscillate at, or near, their resonate frequencies. If this happens, the energy is re-radiated randomly in all directions and dissipated as heat. The solid will be opaque to these frequencies of light. Glass has resonate frequencies in both the ultraviolet and infrared ranges, appearing opaque to both. But it gets more complicated still.
Metals reflect light rather than transmitting or absorbing it.
When light hits the surface of the metal, the electrons at the surface oscillate as before. However, the electrons are only free to oscillate in certain directions due to being at the surface of the material. This in turn limits the direction of re-radiation of light, causing the light to be reflected. An interesting result of this process is that reflected light is strongly polarised. This is utilised by drivers who wear polarised sunglasses to cut down the reflected glare of the road.