I'm currently working on a project that requires me to write a (seemingly endless) series of macros to reproduce pivot tables designed by one of our Analysts. The details change, but the code is largely the same from example to example.
I would like to programmaticly generate the vba code based on a handful of options and then add the macro to the given worksheet. Is it possible to create an excel macro with python using win32com or other? Is it possible to create an excel macro from another excel macro? Any other ideas?
Project Background, I have a python script that does the following:
- pulls Google Analytic data
- does various analysis
- writes the results to excel
- triggers a pre-written macro to turn the data into a beautifully formatted pivot table
- emails it off to people who probably don't actually read it