View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] b_whittle@hotmail.com is offline
external usenet poster
 
Posts: 5
Default BeforeClose vs Auto_Close

I have a nagging issue. I am trying to run a BeforeClose sub but it
just won't go. However, if I replace it with the Auto_Close sub then it
works fine. The code is simple:

private Sub Workbook_BeforeClose(Cancel As Boolean)
MsgBox "close macro is working"
end sub

With the above code I do not see my message box when I close my
workbook. It just closes.

private sub auto_close ()
MsgBox "close macro is working"
end sub

With the above code I get my messagebox (and the useful bits of the
code which I haven't pasted in here). I read something about the need
for events to be enabled, so I ran a macro to enable events
(Application.EnableEvents = True), but to no avail.

It's not a big issue because the Auto_Close does what I need, but as a
fickle follower of fashion I feel out of date. I've read that
Auto_Close is soooooo last centuary ;-). What could I be doing wrong
that stops the beforeclose working but lets auto_close do its job?

regards Ben