Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AutoExec Macro (2000)

    First I have 2 problems. I created a macro in Word and named autoexec. For any reason, when I opened Word I received an erro. Second, I want to know how to make the autoexec macro execute only in another template. For example, if I choose that template instead of the normal.dot to create a document, the macro will execute automatically.

    The error I received above, is when the macro execute in normal.dot. When I put it to another template, it does not execute at all.

  2. #2
    Star Lounger
    Join Date
    Apr 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoExec Macro (2000)

    I found out and called it autonew. It works, but I want to know if this is the best way to go. Will it still be executed after creating a document in that template and opening it later?

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: AutoExec Macro (2000)

    No, AutoNew executes only when creating a new document based on that template. It's the logical place to store code for setting up a document the first time.

    If you want code to run every time you open the document, take a look at AutoOpen.

  4. #4
    Star Lounger
    Join Date
    Apr 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoExec Macro (2000)

    In order to fix the problem, I used both AutoOpen and AutoNew. Is that the only way to do it?

  5. #5
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: AutoExec Macro (2000)

    I'm assuming you have code which needs to be executed both when the document is created, and every time it is opened thereafter. If this is the case, then the AutoNew and AutoOpen macros must contain the same code (or, if the code is extensive, you can set up the code in one of the macros, and have the other simply call that macro to run).
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •