#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"