+ Reply to Thread
Results 1 to 3 of 3

Excel Macro to take user back to page 1 before saving

  1. #1
    Rodney
    Guest

    Excel Macro to take user back to page 1 before saving

    I have a Workbook with 15 pages, the first page is a menu page with several
    buttons to navigate through the workbook, on each other page I have a 'home'
    button linking back to take the user back to the first page.

    My problem arises when the user completes their task cliks on save and then
    exits out of the Workbook (this process bypasses the links) - when they
    return to the Workbook they are automaticlly taken to the last page they used
    not page 1.

    I would like a macro that will take the user back to the home page (Page1)
    then save their work before exiting.

    I have seen several macros that come close but I am unable to create the
    correct one can someone help please.

    ----------------
    This post is a suggestion for Microsoft, and Microsoft responds to the
    suggestions with the most votes. To vote for this suggestion, click the "I
    Agree" button in the message pane. If you do not see the button, follow this
    link to open the suggestion in the Microsoft Web-based Newsreader and then
    click "I Agree" in the message pane.

    http://www.microsoft.com/office/comm...el.programming

  2. #2
    Earl Kiosterud
    Guest

    Re: Excel Macro to take user back to page 1 before saving

    Rodney,

    You could have a macro select your first sheet when it's opened (as long as
    macros are enabled). This will select the first physical sheet (that's
    visible):

    Private Sub Workbook_Open()
    Sheets(1).Activate
    End Sub

    Or you could use:

    Private Sub Workbook_Open()
    Sheets("Menu").Activate
    End Sub

    Substitute the sheet name for "Menu." Note that these are sheets, not
    pages.
    --
    Earl Kiosterud
    www.smokeylake.com

    "Rodney" <[email protected]> wrote in message
    news:[email protected]...
    >I have a Workbook with 15 pages, the first page is a menu page with several
    > buttons to navigate through the workbook, on each other page I have a
    > 'home'
    > button linking back to take the user back to the first page.
    >
    > My problem arises when the user completes their task cliks on save and
    > then
    > exits out of the Workbook (this process bypasses the links) - when they
    > return to the Workbook they are automaticlly taken to the last page they
    > used
    > not page 1.
    >
    > I would like a macro that will take the user back to the home page (Page1)
    > then save their work before exiting.
    >
    > I have seen several macros that come close but I am unable to create the
    > correct one can someone help please.
    >
    > ----------------
    > This post is a suggestion for Microsoft, and Microsoft responds to the
    > suggestions with the most votes. To vote for this suggestion, click the "I
    > Agree" button in the message pane. If you do not see the button, follow
    > this
    > link to open the suggestion in the Microsoft Web-based Newsreader and then
    > click "I Agree" in the message pane.
    >
    > http://www.microsoft.com/office/comm...el.programming




  3. #3
    PT
    Guest

    RE: Excel Macro to take user back to page 1 before saving

    Use the following code. Sheets(1) can be replaced with Sheets("Menu") or
    whatever your menu sheet is called.

    Private Sub Workbook_BeforeClose(Cancel As Boolean)

    Sheets(1).Activate
    ThisWorkbook.Save

    End Sub

    "Rodney" wrote:

    > I have a Workbook with 15 pages, the first page is a menu page with several
    > buttons to navigate through the workbook, on each other page I have a 'home'
    > button linking back to take the user back to the first page.
    >
    > My problem arises when the user completes their task cliks on save and then
    > exits out of the Workbook (this process bypasses the links) - when they
    > return to the Workbook they are automaticlly taken to the last page they used
    > not page 1.
    >
    > I would like a macro that will take the user back to the home page (Page1)
    > then save their work before exiting.
    >
    > I have seen several macros that come close but I am unable to create the
    > correct one can someone help please.
    >
    > ----------------
    > This post is a suggestion for Microsoft, and Microsoft responds to the
    > suggestions with the most votes. To vote for this suggestion, click the "I
    > Agree" button in the message pane. If you do not see the button, follow this
    > link to open the suggestion in the Microsoft Web-based Newsreader and then
    > click "I Agree" in the message pane.
    >
    > http://www.microsoft.com/office/comm...el.programming


+ 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