Been a while since I've had to do any programming in VBA (for which I am exceedingly grateful), but IIRC, the macros in Excel can be imported from an external file. I don't see why you couldn't have your program output
something like this, and then import that into Excel. Or maybe there's even a way to use something like
Spreadsheet::WriteExcel to do that part of it for you.