Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Double prompting of an over-write confirmation when saving a fileof the same name

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. I've tried
isolating the two over-write prompts using MsgBoxes (I was unable to set
breakpoints within the events themselves) but to no avail. The
workbookBeforeSave event is executed only once to execute my modified
SaveAs (FileSaveAs) subroutine. When I execute the SaveAs method from
within my modified SaveAs (FileSaveAs) subroutine 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 does not fire again and MsgBoxes confirm
this 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 'its going to show the SaveAsUI which means user
'clicked "save as" or the file has never been 'saved
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving double-byte characters as unicode text in a CSV file Michael Bond Excel Discussion (Misc queries) 4 January 29th 09 10:01 PM
Saving Excel files to Read/Write only folders vteventrider Excel Discussion (Misc queries) 1 September 5th 07 08:31 PM
Prompting user before saving Simon Lloyd[_447_] Excel Programming 0 May 10th 04 10:55 PM
Prompting user before saving Charles Excel Programming 0 May 10th 04 10:54 PM
Saving an Excel worksheet without getting the confirmation box Mike Excel Programming 1 January 13th 04 04:07 PM


All times are GMT +1. The time now is 06:22 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"