Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Close without saving


Hi!
I have two workbooks open in the same application. I want to close one
without saving it. I use this code but it still asks me if I want to
save changes.

<Code start
ActiveWindow.ActivateNext
ActiveWorkbook.Saved = False
ActiveWorkbook.Close
<End Code

Can I use code that will close without saving and not ask if I want to
save changes?
Thanks!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=510128

  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Close without saving

activeworkbook.Close savechanges:=False

--
When you lose your mind, you free your life.


"Brian Matlack" wrote:


Hi!
I have two workbooks open in the same application. I want to close one
without saving it. I use this code but it still asks me if I want to
save changes.

<Code start
ActiveWindow.ActivateNext
ActiveWorkbook.Saved = False
ActiveWorkbook.Close
<End Code

Can I use code that will close without saving and not ask if I want to
save changes?
Thanks!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=510128


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Close without saving

ActiveWorkbook.Saved = False is telling Excel that the workbook is not saved,
and so it is prompting with the "do you want to save..."

Try ActiveWorkbook.Saved = True; then you will tell Excel that it is already
saved and so Excel will think it is ok to close without saving.
--
- K Dales


"Brian Matlack" wrote:


Hi!
I have two workbooks open in the same application. I want to close one
without saving it. I use this code but it still asks me if I want to
save changes.

<Code start
ActiveWindow.ActivateNext
ActiveWorkbook.Saved = False
ActiveWorkbook.Close
<End Code

Can I use code that will close without saving and not ask if I want to
save changes?
Thanks!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=510128


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default Close without saving

Change the False to True on the Saved line. This tells Excel that there have
been no changes since the last save so that it will not prompt the user to
save again.

ActiveWorkbook.Saved = True

--
HTH...

Jim Thomlinson


"Brian Matlack" wrote:


Hi!
I have two workbooks open in the same application. I want to close one
without saving it. I use this code but it still asks me if I want to
save changes.

<Code start
ActiveWindow.ActivateNext
ActiveWorkbook.Saved = False
ActiveWorkbook.Close
<End Code

Can I use code that will close without saving and not ask if I want to
save changes?
Thanks!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=510128


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Close without saving

whateverworkbookyouwanttoclose.close savechanges:=false

Brian Matlack wrote:

Hi!
I have two workbooks open in the same application. I want to close one
without saving it. I use this code but it still asks me if I want to
save changes.

<Code start
ActiveWindow.ActivateNext
ActiveWorkbook.Saved = False
ActiveWorkbook.Close
<End Code

Can I use code that will close without saving and not ask if I want to
save changes?
Thanks!!

--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=510128


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Close without saving


ben Wrote:
activeworkbook.Close savechanges:=False

--
When you lose your mind, you free your life.


"Brian Matlack" wrote:


Hi!
I have two workbooks open in the same application. I want to close

one
without saving it. I use this code but it still asks me if I want to
save changes.

<Code start
ActiveWindow.ActivateNext
ActiveWorkbook.Saved = False
ActiveWorkbook.Close
<End Code

Can I use code that will close without saving and not ask if I want

to
save changes?
Thanks!!


--
Brian Matlack

------------------------------------------------------------------------
Brian Matlack's Profile:

http://www.excelforum.com/member.php...fo&userid=3508
View this thread:

http://www.excelforum.com/showthread...hreadid=510128




Thanks to all for the great help!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=510128

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
close without saving calebjill Excel Discussion (Misc queries) 1 January 29th 09 11:16 PM
close w/o saving jatman Excel Worksheet Functions 5 February 29th 08 02:52 PM
VBA - Close without saving changes PaulW Excel Discussion (Misc queries) 2 July 27th 06 01:22 PM
Close file without saving Roadie[_4_] Excel Programming 0 October 22nd 04 03:21 PM
Close without Saving In VBA Celtic_Avenger[_14_] Excel Programming 3 September 11th 04 11:04 PM


All times are GMT +1. The time now is 07:23 AM.

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

About Us

"It's about Microsoft Excel"