Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you set a macro to run when a word document is opened?

Status
Not open for further replies.

mikeburg

Technical User
Jun 19, 2003
23
US
How do you set a macro to run when a word document is word document is opened? The macro is only for that particular document.

I know how in excell, I merely name the macro auto_open. Doing so is not working in MS Word.

Mike

mikeburg@gower.net
 
In the vba editor...

(make sure you select "this document" & not normal.dot)

then in the right frame, from the left drop down select "document" and in the right drop down "open"

you will see this auto generated


Private Sub Document_Open()
'your code goes here
End Sub
 
You should also be able to use AutoOpen in any code module, within Word. Note that it is AutoOpen, not Auto_Open.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top