Link to home
Start Free TrialLog in
Avatar of Ro222bin
Ro222bin

asked on

Running a macro when a document is opened

I received instructions for a macro from billhood to change a date in a form letter to 14 days in the future.  My question is, do I have to go to tools run macro everytime I open the letter to change the date?  Or is there some way I can make the macro run each time the document is opened?

Thanks
Avatar of Anne Troy
Anne Troy
Flag of United States of America image

You can rename the macro.

Hit Alt-F11 and click on THIS doc on the left-hand side.

Where it says Sub MacroName(), change it to:

Sub Auto_Open()

Save, close, reopen to test.

Ro. This is NOT a hard question, it's a 25-pointer I think. But if you're going to give them away, I might as well benefit. (hee hee)
Avatar of antrat
antrat

Isn't it
Sub AutoOpen()

Without the underscore for Word?

antrat
Eeek! You're right, ant!
Actually, I believe Office 97 VBA is Auto_Open and Office 2K is AutoOpen? Which version do you have, Ant?
Tuggy, I have 97 only :(

Auto_Open is for Excel
          and
AutoOpen is for Word

Auto_Open  may work for Word ?

I think the same applies in 2000. But with Excel the Auto_Open is really for backward compatability with earlier versions of Excel, the prefered method is now Workbook_Open placed in the Workbook module.


antrat




ASKER CERTIFIED SOLUTION
Avatar of billhood
billhood

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Of course, you can always take a peek at the other solutions from your old question and try one of those (hint, hint) :)

Tristan