You're not going to be able to use it in any full auto mode since it's not capable of reading and supplying E-TTL command signals. You can use any flash via the PC connector on the 40D as long as the sync voltage is less than 250v. You'd have to manually select the camera aperture (and shutter speed) to correspond with the flash power to get the correct exposure.
For any type of serious (or semi-serious) flash work I'd recommend the 430EX, or even a used 420EX. I'd avoid the 220EX because it's underfeatured and only $100 or so cheaper than the 430EX.
See
http://www.bobatkins.com/photography/eosfaq/ex_speedlites.html for more info on Canon Speedlites