ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Quitting a BeforeSave event procedure without saving. (https://www.excelbanter.com/excel-programming/293306-quitting-beforesave-event-procedure-without-saving.html)

Richard Buttrey[_5_]

Quitting a BeforeSave event procedure without saving.
 
In a Workbook BeforeSave procedure, I've got a Message box to which I
expect a Yes/No response.

If the answer is No then I want to simply quit the procedure without
the workbook saving. It seems that whether the answer is Yes or No,
the procedure continues to the end and saves the workbook.

I've tried putting an Exit Sub, or End command after the test but to
no avail.

Can anyone help me out please.

Usual TIA

Rgds,

Richard Buttrey

Frank Kabel

Quitting a BeforeSave event procedure without saving.
 
Hi
add the line
Cancel = True


--
Regards
Frank Kabel
Frankfurt, Germany
"Richard Buttrey" schrieb im Newsbeitrag
m...
In a Workbook BeforeSave procedure, I've got a Message box to which I
expect a Yes/No response.

If the answer is No then I want to simply quit the procedure without
the workbook saving. It seems that whether the answer is Yes or No,
the procedure continues to the end and saves the workbook.

I've tried putting an Exit Sub, or End command after the test but to
no avail.

Can anyone help me out please.

Usual TIA

Rgds,

Richard Buttrey



Richard Buttrey[_5_]

Quitting a BeforeSave event procedure without saving.
 
Brilliant,

Many thanks Karl.





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 12:26 AM.

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