Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AuotExec or AutoOpen (XP)

    What should I be naming a macro if I want it to start when I open a specific spreadsheet? I thought it used to be AutoOpen but that doesn't seem to work!

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AuotExec or AutoOpen (XP)

    You need to put the code into the Workbook Open event routine, which is a little more complicated than just naming the macro.

    1- Use Alt/F8 to open the VBE editor.

    2- If the project explorer is not displayed, then open it by selecting "Project Explorer" from the View menu.

    3- In the Project Explorer, right click on the ThisWorkbook object and select "View Code" from the pop up menu.

    4- Drop down the left hand dropdown list in the editor window and select "Workbook".

    5- Drop down the right hand dropdown list and select "Open".

    You should now have a dummy routine in the editor window that looks like this:

    <pre>Private Sub Workbook_Open()

    End Sub
    </pre>


    Put your code between those two lines.

    There is no AutoExec event for Excel VBA.
    Legare Coleman

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: AuotExec or AutoOpen (XP)

    Auto_Open (note the underscore) should work OK in Excel 2002(XP).

    Also consider Workbook_Open, which is an event in the ThisWorkbook module.

    Andrew C

Posting Permissions

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