View Single Post
  #7   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

Hi Pat,

Glad to hear it worked out! Come on back if you run into any other
problems.

--
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 *


"Pat Beck" wrote in message
...
Brilliant! Absolutely brilliant! I didn't know I could cancel Excel's

save.
That's what was causing the problem. Having done that, it works
magnificently!

I also didn't know that method of calling another procedure. Yes, my
procedures are in the same workbook. But, dummy me, I just thought
Application.Run was the standard method. <g I'll start calling the way

you
say from now on.

I'm so thankful there's experts like you and the others willing to lend a
helping hand.

Thank you ever so much.

Pat

"Rob Bovey" wrote in message
...
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 *