I believe you can do this using Visual Basic, and you can do some VB from within Excel, so perhaps this could be accomplished as you've suggested.
I have some experience using this functionality, but have not used it for this purpose. There is also a Programmer's area on the UG SE Newsgroup. You would need a maintenance contract to get access though.