View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Rob Bovey Rob Bovey is offline
external usenet poster
 
Posts: 811
Default Code in ThisWorkbook crashes Excel

Sorry, I forgot the colon on the end of the ErrorExit label. That's air code
for you. <g

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
''' Cancel Excel's save and replace it with yours.
Cancel = True
''' This ensures that event handling is
''' restored in case of an error.
On Error GoTo ErrorExit
Application.EnableEvents = False
DualSave
ErrorExit:
Application.EnableEvents = True
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *