+ Reply to Thread
Results 1 to 7 of 7

Autorun a macro

Hybrid View

Guest Autorun a macro 09-06-2005, 10:05 AM
Guest RE: Autorun a macro 09-06-2005, 11:05 AM
Guest RE: Autorun a macro 09-06-2005, 11:05 AM
dominicb Good afternoon Paul Wisken ... 09-06-2005, 12:16 PM
Guest Re: Autorun a macro 09-07-2005, 03:05 PM
Guest Re: Autorun a macro 09-06-2005, 11:05 AM
Guest Re: Autorun a macro 09-06-2005, 12:05 PM
  1. #1
    Paul Wisken
    Guest

    Autorun a macro

    I'm sure I'm missing something obvious, but is there a way to make a
    macro/vba program run automatically when the workbook is opened?
    In my case I have a link to data on a server that refreshes on opening the
    workbook and then must be manipulated. Currently I have a button to
    click, but I want to avoid user forgetfulness if possible.
    Thanks
    Paul


  2. #2
    Andy
    Guest

    RE: Autorun a macro

    Hi Paul
    If its the same workbook each time you could try putting the following line
    into the Workbook_Open event procedure of that workbook:

    Application.Run "MacroName"

    Hope that helps

    Andy

    "Paul Wisken" wrote:

    > I'm sure I'm missing something obvious, but is there a way to make a
    > macro/vba program run automatically when the workbook is opened?
    > In my case I have a link to data on a server that refreshes on opening the
    > workbook and then must be manipulated. Currently I have a button to
    > click, but I want to avoid user forgetfulness if possible.
    > Thanks
    > Paul
    >
    >


  3. #3
    Paul Wisken
    Guest

    RE: Autorun a macro



    Thanks Andy,
    Sound simple, but most of that went straight over my head, so it's back
    to the old VB help now to see what you're talking about.
    Paul

    *** Sent via Developersdex http://www.developersdex.com ***

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon Paul Wisken

    Two ways:

    First call your macro Auto_Open eg:
    Sub Auto_Open()

    Second, the above will work but you should really use the event procedures facility. Put the code for your macro in the ThisWorkbook pane within the VBE, rather than the Modules pane and then change the name to Workbook_Open().

    Does that make any more sense...?

    For more information about this have a look here:

    http://www.cpearson.com/excel/events.htm

    HTH

    DominicB

  5. #5
    Whiskers
    Guest

    Re: Autorun a macro

    Thanks everyone.
    It's now working perfectly

    Paul

    *** Sent via Developersdex http://www.developersdex.com ***

  6. #6
    Snake Plissken
    Guest

    Re: Autorun a macro

    section "thisworkbook" in vba manager and then:

    Private Sub Workbook_Open()

    End Sub

  7. #7
    raymond.allan@bench.com
    Guest

    Re: Autorun a macro

    in a module ...

    Sub Auto_Open

    your code here

    End Sub

    As soon as the workbook is open the code in the Auto_Open sub will run


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1