Well – perhaps someone out there can explain to me the logic behind this one – or how to deal with it in any case.
I’m working on a macro that needs to run whenever a user opens a document, or creates a new one from a template.
The macro must run as soon as a file is opened – regardless of what the file is.
In order to cover all possibilities, I’ve setup AutoExec, AutoNew and AutoOpen macros in a global template (globals.dot).
For maintenance purposes, I’d like to keep the macro that is to run in a second global template (printer.dot), though
I have also tried including it in the main global template and it makes no difference one way or the other.
Everything functions as it should – except the AutoExec macro.
AutoExec runs in the following situations if the Word is not already open:
– When the user launches Word via desktop icon or start menu
– When the user opens a document directly from Explorer
– When the user uses the “New Office Document” shortcut under the start menu
– When the user uses the “Open Office Document” shortcut under the start menu
I’m aware that the AutoExec runs before any global templates are loaded by Word,
so I use .OnTime to delay the macro for a bit.
In each case, the macro functions as it should, EXCEPT when the user uses the
“Open Office Document” shortcut under the start menu.
In this case, AutoExec will run (I use a msgbox to test) , but it will not run the other macro ( contained in printers.dot).
No error messages, no nothing. I know the script works because, as I said, if the user launches Word in any other way
(via desktop shortcut or explorer) then the AutoExec macro does what it is supposed to. It is in this ONE scenario only
that it decides not to cooperate.
If anyone has an explanation for this – I’d sure appreciate hearing it.
BTW – While troubleshooting this problem I disabled the scripts in the AutoOpen and AutoNew –
using only a message box so I could tell what script was running when. This ruled out the possibilty
of there being a conflict between the different auto macros.