Use macros in Excel via win32com

beliavsky@aol.com beliavsky at 127.0.0.1
Sat Dec 18 21:52:25 EST 2004


"chris" <chris.stromberger at gmail.com> wrote:
>I'm creating an excel document dynamically from scratch using Python
>and the win32com module.  All is well, but now I need to add a macro to
>the spreadsheet and run it (to enable some sorting features in the
>spreadsheet).  I think I know how to run a macro once it's installed
>(using the Run method of the excel application object...I think), but I
>can't figure out how to "install" the VBA macro code into the
>spreadsheet to begin with from my Python script.
>Any tips appreciated.

Here is a manual solution for Excel 2003. At the bottom of the spreadsheet,
right-click on one of the tabs (default names sheet1 sheet2 sheet3). Click
"view code" on the menu, which should bring up a Microsoft Visual Basic editor.
Select Module from the Insert menu at the top, and paste the VBA code there.



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---



More information about the Python-list mailing list