ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Macro to take user back to page 1 before saving (https://www.excelbanter.com/excel-programming/340015-excel-macro-take-user-back-page-1-before-saving.html)

Rodney

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

Earl Kiosterud

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" wrote in message
...
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




pt

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



All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com