View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Can I stop the close method in an auto close macro

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'do your test and if true
Cancel = True

End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Paul" wrote in message
...
I have an auto close macro running on a file that demands certain cells

are
complete before closing.

Is there a way of stopping the close method within the auto close macro

when
the data is not present.