message box when word opens

M

Mike

How can I get a macro to run when the user opens word template?
I want to display a message box when word is started.

Here's my code i'm trying to execute;

Private Sub Document_Open()
MsgBox "hey there"
End Sub
is this correct? I have it under
Normal --> Microsoft Word Object --> ThisDocument

is that the correct spot to have this code, or should it be somewhere else?
 
P

Peter Hewett

Hi Mike

Spot On. This macro will fire every time a user opens a template based on
Normal.dot, but not if you open a document based on another template.

HTH + Cheers - Peter
 
C

Charles Kenyon

If you want it to run when Word is started, but not everytime a document is
opened, put your code in a macro in normal.dot or another global template.
The macro must be named AutoExec.

I tend to store macros named AutoExec or AutoOpen, AutoNew, AutoClose in a
separate module named AutoMacros because otherwise I end up with multiples.
--

Charles Kenyon

See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

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