Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Nov 2001
    Location
    Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro to operate on close of file (Excel 2000)

    I would like to arrange for a multi page workbook to always open on the first worksheet (Instructions).
    Is it possible to write a macro to operate on closing or opening the file?

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to operate on close of file (Excel 2000)

    Hi Ozzie,

    You need the workbook open event procedure for that:


    Workbook_Open is an "event procedure" and needs to go in the module of the ThisWorkbook object.

    Alt+F11 to the VB editor
    In the project explorer window double-click the ThisWorkbook entry under Microsoft Excel Objects.
    In the code window which should now be showing you the module for ThisWorkbook:
    - select Workbook from the left hand dropdown at the top of the window
    - select Open from the right hand dropdown [may have happened automatically]
    - type your code between the lines
    Private Sub Workbook_Open()
    and
    End Sub
    which will have been generated automatically.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    New Lounger
    Join Date
    Nov 2001
    Location
    Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to operate on close of file (Excel 2000)

    Thanks Jan, can you help me with the code?

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to operate on close of file (Excel 2000)

    Hi Ozzie,

    Private Sub Workbook_Open()
    Thisworkbook.worksheets(1).activate
    End Sub
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  5. #5
    New Lounger
    Join Date
    Nov 2001
    Location
    Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to operate on close of file (Excel 2000)

    Looks simple, I will give it a try.
    Many thanks

  6. #6
    New Lounger
    Join Date
    Nov 2001
    Location
    Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to operate on close of file (Excel 2000)

    It worked fine, thank you.

Posting Permissions

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