In Word 2007, if I want to put all my macros in "AllMacros.dot" and run some
from Normal.dot's AutoOpen macro, how do I get around the fact that the
AllMacros.dot might not be open in time?

(I'm trying to stay compatible with word 2003 so I don't want to use ribbon
stuff. These macros add CommandBar's that I want available in all documents)

If I put "Application.Run "AllMacros.Module1.MyMacro"" in Normal.dot's
AutoOpen it works if I open word (to a blank document) and then open a
document.

But if I run "winword myfile.doc" from the command line, it fails because
Normal.dot's AutoOpen seems to be run BEFORE AllMacros.dot is loaded from the
startup folder. How can I handle this case?

(AutoOpen from AllMacros is not run for all documents so this isn't an
option).

Thank you.

Re: AutoOpen macros and the startup folder by Jay

Jay
Fri Feb 09 21:58:46 CST 2007

You may be able to use the OnTime function to delay the call for a
couple of seconds. See
http://word.mvps.org/faqs/userforms/AutoExecUsertFm.htm for a similar
technique.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 10 Feb 2007 00:45:13 GMT, "John" <john@nousenetspam.com>
wrote:

>In Word 2007, if I want to put all my macros in "AllMacros.dot" and run some
>from Normal.dot's AutoOpen macro, how do I get around the fact that the
>AllMacros.dot might not be open in time?
>
>(I'm trying to stay compatible with word 2003 so I don't want to use ribbon
>stuff. These macros add CommandBar's that I want available in all documents)
>
>If I put "Application.Run "AllMacros.Module1.MyMacro"" in Normal.dot's
>AutoOpen it works if I open word (to a blank document) and then open a
>document.
>
>But if I run "winword myfile.doc" from the command line, it fails because
>Normal.dot's AutoOpen seems to be run BEFORE AllMacros.dot is loaded from the
>startup folder. How can I handle this case?
>
>(AutoOpen from AllMacros is not run for all documents so this isn't an
>option).
>
>Thank you.
>

RE: AutoOpen macros and the startup folder by Sergio

Sergio
Mon Feb 12 05:54:00 CST 2007

I was in a similar situation.

I don't remember the exact code, but I solved it this way:

in the AutoOpen macro I start checking the addins collection to see if my
dot is loaded. If it is not, I force the addins.add of my dot.

hope this helps.

"John" wrote:

> In Word 2007, if I want to put all my macros in "AllMacros.dot" and run some
> from Normal.dot's AutoOpen macro, how do I get around the fact that the
> AllMacros.dot might not be open in time?
>
> (I'm trying to stay compatible with word 2003 so I don't want to use ribbon
> stuff. These macros add CommandBar's that I want available in all documents)
>
> If I put "Application.Run "AllMacros.Module1.MyMacro"" in Normal.dot's
> AutoOpen it works if I open word (to a blank document) and then open a
> document.
>
> But if I run "winword myfile.doc" from the command line, it fails because
> Normal.dot's AutoOpen seems to be run BEFORE AllMacros.dot is loaded from the
> startup folder. How can I handle this case?
>
> (AutoOpen from AllMacros is not run for all documents so this isn't an
> option).
>
> Thank you.
>
>
>