Dave Kong
asked on
MS Word AutoMacros and Scripting
I have created a template with AutoNew and AutoOpen macros. The document works as expected by itself (creating a new doc based on the template triggers the AutoNew macro). However, I cannot get it to work from a script. I am using the line:
"c:\program files\microsoft office\office12\winword.ex e" /t"C:\AFINETY\MACROS\WORD\ AFINETY\Li brary\Marr keting\Pro ject_Descr iptions_Li st.dotm"
The template text is appearing in the new document, but the AutoNew doesn't trigger.
Am I missing a parameter or command. Is there a different way to start up Word based on a specific template?
"c:\program files\microsoft office\office12\winword.ex
The template text is appearing in the new document, but the AutoNew doesn't trigger.
Am I missing a parameter or command. Is there a different way to start up Word based on a specific template?
ASKER
Graham:
I understand what you are saying. I am disappointed that the script will not run the automacro. Starting the new document from within Word would certainly solve the macro triggering problem. However, I need to explain my particular challenge more clearly.
I have created a template that the attorneys need to use for marketing. Our attorneys are a bit of a special case (some semi-luddites), so the director wants to make it as easy for them as possible to start a new marketing document.
Initially, I simply installed a folder on their desktops that contained shortcuts to the templates, which when activated will create a new a document, and any automacros in the templates will trigger.
Now, though, there is a concern that the templates on the machine may not have been updated before the attorney creates a new document. (Templates are updated whenever a user logs into the network, but some attorneys leave their machine on. They can also be updated by running a cmd file as the administrator.) So, essentially I need a one-click (or double-click) way of 1) running the cmd file that updates the macros, and 2) starting a new Word document based on the specified template in a way that will trigger the automacros.
I have attached to this post the script I am currently testing. The initial settings at the top were copied from the our login script, which is what calls up the macro-updating cmd file when a user logs in.
Is it possible to script activating a shortcut? If that is possible, that would solve the problem.
And now that I have explained the ultimate goal, is there possibly a better option for accomplishing both steps other than a Windows script?
Thank you for your help on this issue.
UpdateTemplatesOpenProjDescr.cmd
I understand what you are saying. I am disappointed that the script will not run the automacro. Starting the new document from within Word would certainly solve the macro triggering problem. However, I need to explain my particular challenge more clearly.
I have created a template that the attorneys need to use for marketing. Our attorneys are a bit of a special case (some semi-luddites), so the director wants to make it as easy for them as possible to start a new marketing document.
Initially, I simply installed a folder on their desktops that contained shortcuts to the templates, which when activated will create a new a document, and any automacros in the templates will trigger.
Now, though, there is a concern that the templates on the machine may not have been updated before the attorney creates a new document. (Templates are updated whenever a user logs into the network, but some attorneys leave their machine on. They can also be updated by running a cmd file as the administrator.) So, essentially I need a one-click (or double-click) way of 1) running the cmd file that updates the macros, and 2) starting a new Word document based on the specified template in a way that will trigger the automacros.
I have attached to this post the script I am currently testing. The initial settings at the top were copied from the our login script, which is what calls up the macro-updating cmd file when a user logs in.
Is it possible to script activating a shortcut? If that is possible, that would solve the problem.
And now that I have explained the ultimate goal, is there possibly a better option for accomplishing both steps other than a Windows script?
Thank you for your help on this issue.
UpdateTemplatesOpenProjDescr.cmd
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think your last suggestion would work. Unfortunately, I am restricted by the preferences of our network integrators on template location.
Really, the only issue is making sure that their template is updated before they create a new document. The desktop shortcut and our template selection process within Word do work; they create a new document based on the template and the AutoNew macro triggers.
I think in the case of our relatively small office, I will just make sure the attorney workstations are updated when I post an updated template, which should not happen too frequently. Low-tech, yes, but in the end I think it is better than any process that will just confuse the less tech-inclined attorneys.
I will accept your last suggestion as a solution. Thanks.
Really, the only issue is making sure that their template is updated before they create a new document. The desktop shortcut and our template selection process within Word do work; they create a new document based on the template and the AutoNew macro triggers.
I think in the case of our relatively small office, I will just make sure the attorney workstations are updated when I post an updated template, which should not happen too frequently. Low-tech, yes, but in the end I think it is better than any process that will just confuse the less tech-inclined attorneys.
I will accept your last suggestion as a solution. Thanks.
ASKER
Solution not a good fit for the way our network is configured, but it is a good solution.
You could put a macro in the Normal template to make a new document, and call that with the /m switch
"c:\program files\microsoft office\office12\winword.ex
Open in new window