Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Excel autoexec macro

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Is there a way to create an autoexec macro that invokes each time a file is opened. This feature is available in Access but I can't seem to find any info on an Excel version.

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Do you mean excecute a macro each time ANY file is opened or one SPECIFIC file is opened ?
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  3. #3
    New Member
    Join Date
    Feb 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I mean when a particular file is opened.

    Thank you,

  4. #4
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Then, do this:

    Open the workbook.
    Right click on the little workbook icon next to the "File" menu and choose "View Code"

    Select, from the first dropdown, "Workbook" and from the second one "Open".

    Between these two lines

    Private Sub Workbook_Open()

    End Sub

    You can put the macro you want to execute.

    Regards,

    Juan Pablo González
    http://www.juanpg.com

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Location
    Ireland
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    call the macro Auto_Open if you want it to execute when you open it. If you want it to execute when you close the file (such as to autmatically save changes) call it Auto_Close.


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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