Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
HELP PLEASE
Hello,
I have a class module which modifies the workbookBeforeSave event so that it can execute a customized SaveAs dialogbox instead of the standard one; however, when I click 'Save' with an existing filename it prompts me once with the usual over-write message box and then when I click 'Yes' it prompts me with another message box asking me the same thing except the full path is displayed in this message box. The workbookBeforeSave event is definitely executed only once (to initially execute my modified SaveAs (FileSaveAs) subroutine). When the SaveAs method from within my modified SaveAs (FileSaveAs) subroutine is executed, I disable events immediately preceding the SaveAs method and then I immediately re-enable events after as such: Application.EnableEvents = False ActiveWorkbook.SaveAs sFilename Application.EnableEvents = True The WorkbookBeforeSave event only fires once yet I still get double prompting. Why would this double prompting occur and how do I eliminate it? The WorkbookBeforeSave code is as follows: Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As Boolean, Cancel As Boolean) On Error GoTo BeforeSaveError If SaveAsUI Then Call FileSaveAs Else If Not Wb.Saved Then Application.EnableEvents = False ActiveWorkbook.Save Application.EnableEvents = True End If End If Cancel = True Wb.Saved = True Exit Sub BeforeSaveError: Application.EnableEvents = True MsgBox "Error # " & Err.Number & " " & Err.Description, vbCritical, "Cannot Save File" End Sub Your assistance is very much appreciated. Thanks, Joey. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|