Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open macro created in Excel 97 problems on MAC
Matt
I don't know anything about Macs, but for your second question, you may want to read this http://www.google.com/groups?threadm....microsoft.com -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "Matt R" wrote in message om... I'm having a problem with a macro I created in Excel 97. The macro is designed to unhide sheets in a workbook, then hide a sheet in the workbook. Forcing the user to enable macros to use the workbook. I am having 2 problems with it. One is with MAC's. I do not run on a mac, however some people in the company do. When they tried to open the latest version of my workbook, they would click enable macros. Nothing would happen. The 'banner' sheet opens with instructions to enable macros. There is also a button on it in the event someone has macros enabled but gets the message anyway (My solution to my second problem). The mac users click the button and get an error and cannot continue. The mac users should not even get the chance to click the button thou... The sheet should be hidden by the macro. The previous versions of my workbook work fine on the mac. The only thing I did was add this safegaurd to force users to open macros. Heres the code: Private Sub Workbook_Open() WorkBookFileName = ThisWorkbook.Name ' Use later 'Unhide the sheets UnHideSheets ' Jump to instructions if no name in request ' Else goto the request If (Worksheets("test").Range("B3") = "") Then Sheets("test2").Activate Else Sheets("test").Activate End If End Sub And the Sub (UnHideSheets): Sub UnHideSheets() Sheets("test").Visible = True Sheets("test2").Visible = True Sheets("test3").Visible = True Sheets("test4").Visible = True ' Safe to hide the Enable sheet for now Sheets("Enable").Visible = xlVeryHidden Sheets("test").Activate ' Puts user where they want to be. End Sub My second problem. When the user closes the workbook, there is a before save event to hide the sheets again, and an after save event to make them appear once you've completed the save. So I had the following line in before save (after the hiding off the sheets): Application.OnTime Now, "AfterSave" And the Sub: Sub AfterSave() UnHideSheets End Sub This worked fine and dandy if you click file then save.. Until the user closes the workbook. When it asked if you'd like to save your changes, if you select YES... The before save would run, the file would save, and then they would unhide again and excel won't close! To work around it I removed the aftersave and the user will get a message if they click file then save. It's the banner message stating you must enable macros... Or if you have received this message in error, click this button. Clicking the button basically runs the workbook open event. Is there a way around this so if someone clicks file save they get the workbook back, only after it saved changes with the sheets hidden? and ALSO allow them the exit excel if they click yes when prompted to save changes before exiting? Any help is appreciated. Thanks in advance to all who even take the time to read this message thats too long!! Matt |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open macro created in Excel 97 problems on MAC
"Dick Kusleika" wrote in message ...
Matt I don't know anything about Macs, but for your second question, you may want to read this http://www.google.com/groups?threadm....microsoft.com Dick, I have created macros to hide while saving and unhide when opening. They work great. The only problem is if someone closes the worksheet, gets the message "Do you want to save changes" and selects "YES" The macro's that hide, save and unhide run and the workbook never closes. Matt |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open macro created in Excel 97 problems on MAC
Matt
I thought maybe John Wilson had a solution in that thread. I tested it today, and it doesn't do any better than what you have now. I haven't been able to come up with a solution for you. I thought that by adding a public variable and changing it in the BeforeClose event that you could close the worksheet in the BeforeSave event, but that kept crashing Excel. I think your next step is to program the BeforeClose event similar to how you have the BeforeSave event. Start with Cancel=True, then handle the saving in your code. I haven't tested that either because I'm tired of rebooting. -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "Matt R" wrote in message om... "Dick Kusleika" wrote in message ... Matt I don't know anything about Macs, but for your second question, you may want to read this http://www.google.com/groups?threadm....microsoft.com Dick, I have created macros to hide while saving and unhide when opening. They work great. The only problem is if someone closes the worksheet, gets the message "Do you want to save changes" and selects "YES" The macro's that hide, save and unhide run and the workbook never closes. Matt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problems with IRM protected files created before 18/11/09 | Excel Discussion (Misc queries) | |||
Problems sharing a workbook created from External source | Excel Discussion (Misc queries) | |||
export from Access to Excel has created problems with | New Users to Excel | |||
Workbook_Open macro not running | Excel Discussion (Misc queries) | |||
PC-created files used on a Mac - Problems | Excel Discussion (Misc queries) |