ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to quit in BeforeClose (https://www.excelbanter.com/excel-programming/444771-how-quit-beforeclose.html)

Peter[_68_]

how to quit in BeforeClose
 
Hi.

(Excel 2010)
I need to check if the user has changed the name at the actual sheet
before the workbook is closed.

In my sub Workbook_BeforeClose(Cancel As Boolean)
I have a YesNo box. The intention is, that if the user select No the
workbook shall remain open, e.g. the sub shall not be executed.

How do I do ?

Regards

Peter


Don Guillett[_2_]

how to quit in BeforeClose
 
On Jul 14, 7:49*am, Peter wrote:
Hi.

(Excel 2010)
I need to check if the user has changed the name at the actual sheet
before the workbook is closed.

In my sub Workbook_BeforeClose(Cancel As Boolean)
I have a YesNo box. The intention is, that if the user select No the
workbook shall remain open, e.g. the sub shall not be executed.

How do I do ?

Regards

Peter


As ALWAYS, post your efforts for comments and suggestions.

Peter[_68_]

how to quit in BeforeClose
 
Hi.

I did find a way:


Sub Workbook_BeforeClose(Cancel As Boolean)

a = MsgBox("Fik du rettet navnet på det nye ark ?", vbYesNo)
If a = vbNo Then Cancel = True

end sub

Thank you

Peter

GS[_2_]

how to quit in BeforeClose
 
Peter expressed precisely :
Hi.

I did find a way:


Sub Workbook_BeforeClose(Cancel As Boolean)

a = MsgBox("Fik du rettet navnet på det nye ark ?", vbYesNo)
If a = vbNo Then Cancel = True

end sub

Thank you

Peter


Congratulations!!! That's exactly how it's done...

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com