Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a workbook that requires macros enabled to use properly.
I have created a worksheet with a warning message that will only be hidden by a startup macro and to ensure this displays, I have the following code for the BeforeSave event that shows the sheet, hides all others and then reverses this after the save. This works great when the user chooses Save or SaveAs, however when the user closes the workbook and chooses to save, the save does not happen. The save name for a new workbook does not get passed and SaveUI has a value of False. Does anyone have any ideas why this should happen and what I can do to solve this issue? Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim sFile Application.EnableEvents = False '<Optional - this would be before save code If SaveAsUI Then sFile = Application.GetSaveAsFilename(, "Excel Files (*.xls), *.xls") End If SetMacroWarn If SaveAsUI Then If sFile < False Then ThisWorkbook.SaveAs sFile ThisWorkbook.Saved = True '<Optional - this would be after save code RemoveMacroWarn End If Else ThisWorkbook.Save ThisWorkbook.Saved = True '<Optional - this would be after save code RemoveMacroWarn End If Application.EnableEvents = True Cancel = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open and Save fail after SP1 | Setting up and Configuration of Excel | |||
Macros Referenced in Custom Menu Fail after Save | Excel Programming | |||
How do you force excel to save on close | Excel Discussion (Misc queries) | |||
Close excel do not save | Excel Worksheet Functions | |||
Save and Close Excel using OnTime | Excel Programming |