problem with event handling

J

joel

What I am trying to do is to get a section of code to run whenever a specific
document (not a template) is opened (using Word 2003 with WinXP SP2). I have
put the following test event handling code in the 'ThisDocument' object of
the word document's project:

Private Sub Document_Open()
MsgBox "Opening document"
End Sub

However, when I close the document and open it up again, the code doesn't
appear to execute i.e. the message box doesn't display. Does this event
handling work with documents that aren't templates? Is there something I'm
missing?

Thanks in advance for your help
 
J

Jonathan West

joel said:
What I am trying to do is to get a section of code to run whenever a
specific
document (not a template) is opened (using Word 2003 with WinXP SP2). I
have
put the following test event handling code in the 'ThisDocument' object of
the word document's project:

Private Sub Document_Open()
MsgBox "Opening document"
End Sub

However, when I close the document and open it up again, the code doesn't
appear to execute i.e. the message box doesn't display. Does this event
handling work with documents that aren't templates? Is there something I'm
missing?

Thanks in advance for your help

Which version of Word are you running?
What are your security settings? (go to Tools, Macro, Security) to find out.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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