View Single Post
 
Old 04-06-2013, 09:36 AM
etippelt etippelt is offline Windows XP Office 2007
Novice
 
Join Date: Apr 2013
Posts: 3
etippelt is on a distinguished road
Smile Adding macro to normal.dotm programmatically

Here is my challenge:
As part of a customised application installation, I need to insert an autoexec macro into Normal.dotm. I cannot use the startup folder as this is a network shared location and the addins I need to load are licensed and cannot be generally available.
I have set up a local trusted folder in which the addins are installed, and I have enabled the use of VBA code in the trust centre. The macro I have created works fine when added manually to Normal.dotm, but I can't expect users to go through the process of adding the macro themselves, so I want to do this through code using the Word automation object. Unfortunately I am not a programmer and struggle with the coding of automation scripts. I have exported my macro as a .BAS file, so all that is left is some vbscript code (ideally) that will load the word object and poke the macro code into Normal.dotm.
Can anyone help me with the code, or point me at a web resource where I can find some code that I can adapt. Needless to say I have spent a long time Googling on various search strings to find an answer, but so far to no avail. I do understand that direct editing of Normal.dotm is not the preferred way of doing this, but in our particular circumstances, that is the only way that maintains compatibility with all the different implementations of Office 2007 at our University.
Reply With Quote