Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JAO JAO is offline
external usenet poster
 
Posts: 3
Default vba Cancel Save As

I have written a macro that shows the Save As dialogue box, but I'd like to
add code that closes a workbook if the user selects "cancel".

Can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default vba Cancel Save As

When using the GetSaveAsFilename method, the method returns FALSE if the user
clicks Cancel. Thus, you only need to check the result of the method.

Dim response
response = Application.GetSaveAsFilename

if not response then
' User clicked false
Workbooks(NumberOrNameHere).close
else
' Do stuff
End if

HTH,
Matthew Pfluger

"JAO" wrote:

I have written a macro that shows the Save As dialogue box, but I'd like to
add code that closes a workbook if the user selects "cancel".

Can anyone help?

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
can I cancel a save juls!1601 Excel Discussion (Misc queries) 2 February 16th 06 01:03 AM
Hii All!!!! does anybody knows how can i cancel the save and the save as commands Alon Excel Programming 2 February 7th 06 12:59 AM
Cancel Macro is user selects 'cancel' at save menu Mark Excel Programming 1 April 6th 05 05:45 PM
How to Cancel a Save? Rodg2000 Excel Programming 1 January 9th 04 10:47 AM


All times are GMT +1. The time now is 01:32 PM.

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"