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.
Jay Freedman - 10 Feb 2007 03:58 GMT
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.
>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
[quoted text clipped - 15 lines]
>
>Thank you.
Sergio - 12 Feb 2007 11:54 GMT
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.
> 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
[quoted text clipped - 15 lines]
>
> Thank you.