Global VBA on Open event

G

Gordon Price

I am trying to write some code that will set the Review view to Final, as
apposed to Final with Markup, whnever a file is opened, and specifically when
a bunch of files are "opened" via a batch print from Explorer. I have tried
subs called Document_Open and Auto_Open, and stored them in a DOT file that
is being loaded as a Global Template. And so far no good. The code itself
works, just the auto execution is not working.
Anyone have some suggestions?

Thanks,
Gordon
 
G

Gordon Price

Jezebel said:
Use AutoOpen (without the underscore). Auto_Open is Excel.
Partial "Doh!". I corrected that, and still no joy. So, where should my DOT
file go to be loaded automatically. I currently have it on my desktop, and
indeed it shows up in my Global templates and add-ins list, but it is not
checked as loaded when I start Word. How do I make my template automatically
available? Probably something very simple I am missing here.

Thanks,
Gordon
 
J

Jezebel

You need to put it in the STARTUP folder. Tools > Options > File Locations
will show you where this is. Usually

C:\Documents and Settings\[username]\Application Data\Microsoft\Word\STARTUP

or you can use

C:\Program Files\Microsoft Office\OFFICE11\STARTUP
 
J

Jonathan West

No this isn't right. If you want a macro located in an add-in in the startup
folder to run automatically whenever a document is opened, then you can't
just use AutoOpen.

AutoOpen runs in the following cases only

1. When the macro is located in normal.dot.
2. When the macro is located in the template the document is based on.

If you want code to run in an add-in when any document is opened, you need
to use application event procedures. These articles describe how.

"How to create global event procedures similar to AutoOpen, AutoNew and
AutoClose, without using Normal.dot"
http://www.word.mvps.org/FAQs/MacrosVBA/PseudoAutoMacros.htm

Writing application event procedures
http://www.word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm


--
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

Jezebel said:
You need to put it in the STARTUP folder. Tools > Options > File Locations
will show you where this is. Usually

C:\Documents and Settings\[username]\Application
Data\Microsoft\Word\STARTUP

or you can use

C:\Program Files\Microsoft Office\OFFICE11\STARTUP




Gordon Price said:
Partial "Doh!". I corrected that, and still no joy. So, where should my
DOT
file go to be loaded automatically. I currently have it on my desktop,
and
indeed it shows up in my Global templates and add-ins list, but it is not
checked as loaded when I start Word. How do I make my template
automatically
available? Probably something very simple I am missing here.

Thanks,
Gordon
 

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