Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to Cancel a Save?

I have a macro that runs as an Auto_Close when a person doubleclicks to
close a spreadsheet, or chooses the close on the File menu. As part of the
macro, I do some checking and if I determine that there has been a
particular error made, I want to pop up a MsgBox alerting the person to the
error, and then force them to fix it prior to doing the save (ie, abort the
Save in progress and just resume on the spreadsheet).

I have everything figured out except... once I am into the Auto_Close macro,
and I find the error and report it, I can't figure out how to prevent the
Standard Close message "Save.. Yes, No, or Cancel" from appearing right
after the MsgBox and the subsequent Save being done. I don't want them to
be able to respond Yes, or for that matter have to respond at all. How do I
put the brakes on the Save that Excel is trying to do?

TIA Rodg2000


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to Cancel a Save?

Rodg,

Assuming that you have XL97 or later, you should use the
Workbook_BeforeClose event, which has a Cancel argument. If you find a
condition that causes you to want to Cancel, set Cancel to True.

This event code goes into the ThisWorkbook code module.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Rodg2000" wrote in message
...
I have a macro that runs as an Auto_Close when a person doubleclicks to
close a spreadsheet, or chooses the close on the File menu. As part of the
macro, I do some checking and if I determine that there has been a
particular error made, I want to pop up a MsgBox alerting the person to

the
error, and then force them to fix it prior to doing the save (ie, abort

the
Save in progress and just resume on the spreadsheet).

I have everything figured out except... once I am into the Auto_Close

macro,
and I find the error and report it, I can't figure out how to prevent the
Standard Close message "Save.. Yes, No, or Cancel" from appearing right
after the MsgBox and the subsequent Save being done. I don't want them to
be able to respond Yes, or for that matter have to respond at all. How do

I
put the brakes on the Save that Excel is trying to do?

TIA Rodg2000




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cancel save lawson Excel Discussion (Misc queries) 1 October 11th 07 11:00 PM
Save - Yes / No / Cancel Jon Peltier Excel Discussion (Misc queries) 9 May 7th 06 02:03 AM
can I cancel a save juls!1601 Excel Discussion (Misc queries) 2 February 16th 06 01:03 AM
Cancel user's changes but save other changes [email protected] Excel Discussion (Misc queries) 1 December 19th 05 12:09 PM
Cancel in Save As and Open Con[_3_] Excel Programming 2 January 5th 04 12:50 PM


All times are GMT +1. The time now is 09:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"