Can I stop the close method in an auto close macro
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. |
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. |
Can I stop the close method in an auto close macro
Bob - many thanks for your help - this is absolutely what I needed.
"Bob Phillips" wrote: 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. |
All times are GMT +1. The time now is 03:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com