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

Word auto macros

Status
Not open for further replies.

Nelviticus

Programmer
Sep 9, 2003
1,819
GB
Hello,

I'm trying to write some code that sets the page view to page width zoom when I start Word. This is because it occasionally gets reset to some other value, which really irritates me. The code to do this is:

Code:
ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitBestFit

However, I can't put this in an AutoExec macro because ActivePane isn't available when AutoExec runs. I tried putting it in the AutoNew macro but that doesn't seem to fire when Word starts.

Any ideas where I can put this so that it runs when I start Word?

Thanks

Nelviticus
 
The view is saved with the document, so setting it just once upon opening Word won't do the trick. So Muzzery is right - put it in the AutoOpen sub, in your normal.dot.

Rob
[flowerface]
 
Hmm, I've tried putting it in AutoOpen but that doesn't fire when Word starts up either. It seems that the only one that runs is AutoExec, and you can't access any document-level objects.

I tried putting a 'Stop' as the first line in AutoExec so that I could step through what happens when Word starts, and neither AutoOpen nor AutoNew runs.

I guess I'll just have to live with it - thanks anyway, people.

N.
 
I thought add-ins were just for Excel. I'll look into it though.

N.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top