Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Nov 2002
    Location
    South Carolina, USA
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro to run automatically (Excel 2003)

    Is there a way to force a macro to run automatically when the user opens the spreadsheet? I can not locate any information and I know there must be a way.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to run automatically (Excel 2003)

    A macro named Auto_Open will be run automatically when the workbook is opened.

  3. #3
    3 Star Lounger
    Join Date
    Nov 2002
    Location
    South Carolina, USA
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to run automatically (Excel 2003)

    Thanks!

    It is Friday and my mind is gone. I renamed the macro auto_open and it works great!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to run automatically (Excel 2003)

    Another option is to create a procedure named Workbook_Open in the ThisWorkbook module. It won't work if you use a different name or if you place the procedure in a standard module. Workbook_Open is a so-called event handler. Like Auto_Open, Workbook_Open will be run each time the workbook is opened.

  5. #5
    3 Star Lounger
    Join Date
    Nov 2002
    Location
    South Carolina, USA
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to run automatically (Excel 2003)

    Thanks for the information. I have everything working and it is so great.

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Macro to run automatically (Excel 2003)

    Beware of a limitaiton of the "Auto_Open". It only runs when manually opening a file. If the file is opened via code, a workbook_open will run but not an "Auto_open"

    Steve

Posting Permissions

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