I have a Perl script that can define and write a MS Word macro according to the user's input.
But how can I make the Perl script open Word and add the macro into its macros data base?
I have a Perl script that can define and write a MS Word macro according to the user's input.
But how can I make the Perl script open Word and add the macro into its macros data base?
You can do that by accessing the VBProject
property of the document. However, with recent versions of Microsoft Office, you will likely get:
OLE exception from "Microsoft Word": Programmatic access to Visual Basic Project is not trusted.
See You may receive an run-time error when you programmatically allow access KB article for more information.
Or, you can try to do it the primitive way by sending keystrokes to Word using Win32::GuiTest.
Thank you Sinan.
Since you say that VBProject doesn't always work, then it's not an option for me...
Sorry for my complete ignorance... but what is "Win32::GuiTest" ? Can you please give me an example of how to add a Macro to Word from within a perl script (or even straight from the dos-cmd-line) ?
Thanks a lot, Roni