The ballasts are rated for wattage, not for bulb size. So in theory you can plug in a 40W PC or T5 into that old 40W T12 ballast (with new end caps) & it should work.
So yes, an old 40W ballasts will light a T10 or 12 40W tube. <It will even work with a 40W T8 - although I have only seen those at lfs for $$$$.> I have old magnetic fixtures running 36W T12's in my garage, but they will not light a 32W T8 .... but if it works, it is like overdriving & will shorten the bulb life. However, most people need to change bulbs after 6-12 months anyways, so that is a moot point. <The Overdirve fanatics typically put 80W ballasts to a 40W bulb, & still get 6 or so month of use.>
At any rate, my suggestion to try a T8 does not mean use a $30 lfs bulb. Rather, a $3 Home depot tube.
PS - one more sign of an old magnetic ballast - it hums in use.