General discussion

  • Creator
    Topic
  • #2188871

    Excel – execute macro on opening

    Locked

    by jjoc11762 ·

    I would like to automatically execute a macro whenever a workbook is opened.

    Thanks

    Joe

All Comments

  • Author
    Replies
    • #3046412

      F1

      by charliespencer ·

      In reply to Excel – execute macro on opening

      Aw c’mon, did you even -try- to use the built-in Help function? What are you a consultant on?

      Click Help.
      In the Search box, enter “macros”.
      In the Search results, click “Run a macro”.
      Now click “Have a macro run automatically…”

      These steps are detailed for Excel 2003. The sequence may be different for other versions; your mileage may vary. Offer void where prohibited.

      • #3045319

        Thanks

        by jjoc11762 ·

        In reply to F1

        Thanks very much.
        I am retired – used to manage the installation of PeopleSoft HR systems etc.

        I am fooling around with VBA

        Thanks

    • #3045057

      On-Open event handler

      by bschaettle ·

      In reply to Excel – execute macro on opening

      Joe,
      You need to code an event handler for the “Open” event of the workbook, which is really easy. Just paste this code into the VBA editor:

      Private Sub Workbook_Open()
      MsgBox “You opened the workbook.”
      End Sub

Viewing 1 reply thread