Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

Global VBA on Open event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gordon Price - 03 Apr 2006 23:42 GMT
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
Jezebel - 04 Apr 2006 00:22 GMT
Use AutoOpen (without the underscore). Auto_Open is Excel.

>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
[quoted text clipped - 9 lines]
> Thanks,
> Gordon
Gordon Price - 04 Apr 2006 00:56 GMT
> 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
Jezebel - 04 Apr 2006 01:06 GMT
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

>> Use AutoOpen (without the underscore). Auto_Open is Excel.
> Partial "Doh!". I corrected that, and still no joy. So, where should my
[quoted text clipped - 7 lines]
> Thanks,
> Gordon
Jonathan West - 04 Apr 2006 01:24 GMT
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

Signature

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

> You need to put it in the STARTUP folder. Tools > Options > File Locations
> will show you where this is. Usually
[quoted text clipped - 18 lines]
>> Thanks,
>> Gordon
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.