Add VBA code to a MS Word document using Perl
I have a Perl script that can define and write MS Word VBA according to the us开发者_开发技巧er's input.
How can I make the Perl script open Word and add the VBA code into its code 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.
精彩评论