• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 31. Recording and Running Visual... > Creating Macros That Run Automatical...

Creating Macros That Run Automatically

In most cases you should give your macro a name that describes its function, so that you can easily remember its purpose at a later time. There are, however, several special names you can give your macros. These names cause your macros to run automatically when certain events occur in Word:

  • A macro named AutoExec runs when you start Word. For this macro to work you need to store it in your Normal.dot template or another global template.

    Note

    The capitalization used for macro names in this discussion isn't required. These are the names as they are referred to in the Microsoft Word documentation. Because other programmers are familiar with the capitalization used here it is recommended that you use the same capitalization.


  • A macro named AutoExit runs when you exit Word. If you want a macro to run every time you exit Word you should store this macro in Normal.dot or another global template.

  • A macro named AutoNew runs when you create a new document. If you save this macro in a specific template, such as a memo template, then the macro runs each time you create a new document based upon that template.

  • A macro named AutoClose runs when you close a document. If you save this macro in a specific template, it runs when you attempt to close the template or any document based upon the template.

  • A macro named AutoOpen runs when you open the template that contains it, or any document based upon the template.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint