Calling sub from ThisDocument

P

Poseur

Two questions, really.
I've got my macros in "MyMacros.dot" startup template. But I
need some of them in my Normal.ThisDocument
Document_New/Open/Close routines.
Haven't been able to call them out of the MyMacros project with
any variation of syntax ([MyMacros.vbp].[Utils].DoSomething).
So, I've had to copy some of them over to a local module in
Normal which seems kind of silly and redundant.

Is that because you just can't call out of project from
ThisDocument or because I just don't know how to do it?
 
C

Charles Kenyon

Have you tried Application.Run MacroName:="MyMacro"

This may have a problem if used when Word is first opened because your new
document module may try to run before your Add-In is loaded.
 
P

Poseur

Have you tried Application.Run MacroName:="MyMacro"

This may have a problem if used when Word is first opened
because your new document module may try to run before your
Add-In is loaded.

Thanks. The suggestion from the previous responder (my
apologies, his post has disappeared off the server) finally sunk
in. The trick was to add a reference to Project "MyMacros.Dot"
to "Normal.dot" from within the IDE. The "MyMacros" add-in or
template loads on startup in Word but that was not sufficient
for the Normal template to refer to it's procedures.

Had me stumped for a while cause when I opened the "References"
dialog in VBA, Project "MyMacros" did not appear among the
uncheckeds. But I added it by browing to the .dot file and now
everything is good.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top