Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default macro to close file and not save changes

I have a "helper" file that opens, performs some tasks and then closes in a
macro, but before it closes, a pop up window appears and asks if I want to
save changes...I do not. Is there a code I can use so that that pop up
window does not appear or to automatically select "no"?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default macro to close file and not save changes

Assuming you are using the active workbook to reference you helper file then
this will do it

ActiveWorkbook.Close SaveChanges:=False

or otherwise

Workbooks("Whatever").Close SaveChanges:=False
--
HTH...

Jim Thomlinson


"DB74" wrote:

I have a "helper" file that opens, performs some tasks and then closes in a
macro, but before it closes, a pop up window appears and asks if I want to
save changes...I do not. Is there a code I can use so that that pop up
window does not appear or to automatically select "no"?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default macro to close file and not save changes

Thanks Jim, that is what I was looking for...I also needed to ask on the
opening, it states that the file already exists, do you want to replace file,
I want to select yes. Do you know the code for that one?

"Jim Thomlinson" wrote:

Assuming you are using the active workbook to reference you helper file then
this will do it

ActiveWorkbook.Close SaveChanges:=False

or otherwise

Workbooks("Whatever").Close SaveChanges:=False
--
HTH...

Jim Thomlinson


"DB74" wrote:

I have a "helper" file that opens, performs some tasks and then closes in a
macro, but before it closes, a pop up window appears and asks if I want to
save changes...I do not. Is there a code I can use so that that pop up
window does not appear or to automatically select "no"?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default macro to close file and not save changes

I am a little lost with on the openeing and replace existing but you can try

Application.DisplayAlerts = false
'your code
Application.Displayalerts = true
--
HTH...

Jim Thomlinson


"DB74" wrote:

Thanks Jim, that is what I was looking for...I also needed to ask on the
opening, it states that the file already exists, do you want to replace file,
I want to select yes. Do you know the code for that one?

"Jim Thomlinson" wrote:

Assuming you are using the active workbook to reference you helper file then
this will do it

ActiveWorkbook.Close SaveChanges:=False

or otherwise

Workbooks("Whatever").Close SaveChanges:=False
--
HTH...

Jim Thomlinson


"DB74" wrote:

I have a "helper" file that opens, performs some tasks and then closes in a
macro, but before it closes, a pop up window appears and asks if I want to
save changes...I do not. Is there a code I can use so that that pop up
window does not appear or to automatically select "no"?

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
Macro to save and close, then copy file NewSysAdmin Excel Discussion (Misc queries) 2 December 2nd 09 03:24 PM
How to code the Macro to save and close a file? Eric Excel Discussion (Misc queries) 7 June 10th 07 03:28 PM
Close & save a file at set time only IF the file is open Clivey_UK[_5_] Excel Programming 2 May 1st 06 06:19 PM
CLOSE ALL macro for XL2K (but with prompt to save for each file)? StargateFan[_3_] Excel Programming 2 August 10th 05 02:32 PM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


All times are GMT +1. The time now is 04:38 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"