ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   "Do You Want to Save Changes" message window (https://www.excelbanter.com/excel-programming/428970-do-you-want-save-changes-message-window.html)

RLY

"Do You Want to Save Changes" message window
 
I'm ending a simple data transfer macro with:

Windows(DwnldName).Activate
Application.CutCopyMode = False
ActiveWindow.Close

However, I still receive that "Do you want to save changes" message window
before the system will close the "source" spreadsheet. Can I add some code to
bypass this step & force the source to close w/o saving?

Thanks, Robert


FSt1

"Do You Want to Save Changes" message window
 
hi
at the beginning of your code add..
application.displayalerts = false
then at the end of your code, be sure to turn alerts back on.....
application.displayalerts = true

Regards
FSt1

"RLY" wrote:

I'm ending a simple data transfer macro with:

Windows(DwnldName).Activate
Application.CutCopyMode = False
ActiveWindow.Close

However, I still receive that "Do you want to save changes" message window
before the system will close the "source" spreadsheet. Can I add some code to
bypass this step & force the source to close w/o saving?

Thanks, Robert


Dave Peterson

"Do You Want to Save Changes" message window
 
I'd drop the use of the windows collection and use something like:

Workbooks(dwnldname).close savechanges:=false

Where dwnldname is a variable that includes the extension, right?

RLY wrote:

I'm ending a simple data transfer macro with:

Windows(DwnldName).Activate
Application.CutCopyMode = False
ActiveWindow.Close

However, I still receive that "Do you want to save changes" message window
before the system will close the "source" spreadsheet. Can I add some code to
bypass this step & force the source to close w/o saving?

Thanks, Robert


--

Dave Peterson

AltaEgo

"Do You Want to Save Changes" message window
 
Leave it either way to the user whether or not to save:

Application.DisplayAlerts = False
ActiveWindow.Close
Application.DisplayAlerts = True


OR
ActiveWindow.Close SaveChanges:=False'does not save changes

OR
ActiveWindow.Close SaveChanges:=True ' save changes



--
Steve

"RLY" wrote in message
...
I'm ending a simple data transfer macro with:

Windows(DwnldName).Activate
Application.CutCopyMode = False
ActiveWindow.Close

However, I still receive that "Do you want to save changes" message window
before the system will close the "source" spreadsheet. Can I add some code
to
bypass this step & force the source to close w/o saving?

Thanks, Robert



All times are GMT +1. The time now is 12:24 PM.

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