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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On open document event?

Status
Not open for further replies.

TechnicalLoser

Technical User
Nov 19, 2001
26
0
0
CA
I have a script that adds a menu to the menu bar. What I want to do is have that script run automatically when I open a certain Word Document. I have searched through the threads and found some help but I can never get the document_open() event to work properly. This must be a pretty common script, can anyone copy me a 'hunk' of their code that runs a macro on document open.

Thank you very much.

TL
 
The reason the Document_Open() event doesn't fire is probably because the security level is too high. If the application's security level is set to 'High' then macros are automatically disabled.

Set the Security level to Medium and the user will be prompted to enable macros at startup.

Set the Security level to Low and no prompts will appear / macros will be enabled.

We can thank all the virus writers for this hassle. VBSlammer
redinvader3walking.gif

Unemployed in Houston, Texas
 
Thanks VBSlammer,
I have my security set at medium, and I am prompted when I open the document whether I want to enable macros or not. Which I do.

I think the problem I have is with the declaration of the object (app). I have read and tried the 3 step process but can never quite get it to work. That's why I was hoping someone had a chunk of code I could just manipulate.

Thanks for your help.
TL.
 
You only need the application object if you are writing an application class event handler - which you don't need to do, if all you need is a document_open macro for a particular document. Could you clarify what you are trying to accomplish?
Cheers
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top