PC Review


Reply
Thread Tools Rate Thread

Close workbook without saving file

 
 
Kent.Boucher@tbs-sct.gc.ca
Guest
Posts: n/a
 
      6th Mar 2008
Good morning,
I am aware that this issue has been raised
several times, however, i have yet to find a string of code that
actually gets RID of the "would you like to save prompt"!

I am using excel 2003 and i have tried all of the codes below with NO
success:

1) Windows("file_name.xls").Activate
ActiveWorkbook.Close (savechanges = False)

2) currentWorkbook.Close savechanges = False

3) Application.DisplayAlerts = False
ActiveWorkbook.Close

Nothing i have tried from previous articles has helped; any advice
would be greatly appreciated.


 
Reply With Quote
 
 
 
 
joshuafandango@dsl.pipex.com
Guest
Posts: n/a
 
      6th Mar 2008
Hi Kent,

In the 'This Workbook' object:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Saved = True
End Sub

Cheers,
JF.
 
Reply With Quote
 
Barb Reinhardt
Guest
Posts: n/a
 
      6th Mar 2008
I've used

Application.DisplayAlerts = FALSE

Save code

Application.DisplayAlerts = TRUE

with success. I usually do this though so that I know I'm working on the
correct workbook.

Dim aWB as Workbook

Set aWB = Nothing
on Error resume next
Set aWB = Workbooks("file_name.xls")
on error goto 0

if Not aWB is nothing then ...
Do whatever you'd do with the aWB.
end if
--
HTH,
Barb Reinhardt



"(E-Mail Removed)" wrote:

> Good morning,
> I am aware that this issue has been raised
> several times, however, i have yet to find a string of code that
> actually gets RID of the "would you like to save prompt"!
>
> I am using excel 2003 and i have tried all of the codes below with NO
> success:
>
> 1) Windows("file_name.xls").Activate
> ActiveWorkbook.Close (savechanges = False)
>
> 2) currentWorkbook.Close savechanges = False
>
> 3) Application.DisplayAlerts = False
> ActiveWorkbook.Close
>
> Nothing i have tried from previous articles has helped; any advice
> would be greatly appreciated.
>
>
>

 
Reply With Quote
 
JP
Guest
Posts: n/a
 
      6th Mar 2008
Try

ActiveWorkbook.Saved = True
ActiveWorkbook.Close

From XL 2003 Help:

You can set this property to True if you want to close a modified
workbook without either saving it or being prompted to save it.


HTH,
JP


On Mar 6, 9:37*am, Kent.Bouc...@tbs-sct.gc.ca wrote:
> Good morning,
> * * * * * * * * * * * I am aware that this issue hasbeen raised
> several times, however, i have yet to find a string of code that
> actually gets RID of the "would you like to save prompt"!
>
> I am using excel 2003 and i have tried all of the codes below with NO
> success:
>
> 1) Windows("file_name.xls").Activate
> * * ActiveWorkbook.Close (savechanges = False)
>
> 2) currentWorkbook.Close savechanges = False
>
> 3) Application.DisplayAlerts = False
> * * ActiveWorkbook.Close
>
> Nothing i have tried from previous articles has helped; any advice
> would be greatly appreciated.


 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      6th Mar 2008
maybe this

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Saved = True
End Sub

Mike

"(E-Mail Removed)" wrote:

> Good morning,
> I am aware that this issue has been raised
> several times, however, i have yet to find a string of code that
> actually gets RID of the "would you like to save prompt"!
>
> I am using excel 2003 and i have tried all of the codes below with NO
> success:
>
> 1) Windows("file_name.xls").Activate
> ActiveWorkbook.Close (savechanges = False)
>
> 2) currentWorkbook.Close savechanges = False
>
> 3) Application.DisplayAlerts = False
> ActiveWorkbook.Close
>
> Nothing i have tried from previous articles has helped; any advice
> would be greatly appreciated.
>
>
>

 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      6th Mar 2008
you need a colon before the equals sign

Workbooks(fname).Close savechanges:=False

--

Gary
Excel 2003


<(E-Mail Removed)> wrote in message
news:59f145b7-3479-4080-b8fa-(E-Mail Removed)...
> Good morning,
> I am aware that this issue has been raised
> several times, however, i have yet to find a string of code that
> actually gets RID of the "would you like to save prompt"!
>
> I am using excel 2003 and i have tried all of the codes below with NO
> success:
>
> 1) Windows("file_name.xls").Activate
> ActiveWorkbook.Close (savechanges = False)
>
> 2) currentWorkbook.Close savechanges = False
>
> 3) Application.DisplayAlerts = False
> ActiveWorkbook.Close
>
> Nothing i have tried from previous articles has helped; any advice
> would be greatly appreciated.
>
>


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      6th Mar 2008
Do you want to save it or not?

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



<(E-Mail Removed)> wrote in message
news:59f145b7-3479-4080-b8fa-(E-Mail Removed)...
> Good morning,
> I am aware that this issue has been raised
> several times, however, i have yet to find a string of code that
> actually gets RID of the "would you like to save prompt"!
>
> I am using excel 2003 and i have tried all of the codes below with NO
> success:
>
> 1) Windows("file_name.xls").Activate
> ActiveWorkbook.Close (savechanges = False)
>
> 2) currentWorkbook.Close savechanges = False
>
> 3) Application.DisplayAlerts = False
> ActiveWorkbook.Close
>
> Nothing i have tried from previous articles has helped; any advice
> would be greatly appreciated.
>
>



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      6th Mar 2008
You've got to be careful with your syntax:

Windows("file_name.xls").Activate
ActiveWorkbook.Close savechanges:=False

or just:

workbooks("file_name.xls").Close savechanges:=False


(E-Mail Removed) wrote:
>
> Good morning,
> I am aware that this issue has been raised
> several times, however, i have yet to find a string of code that
> actually gets RID of the "would you like to save prompt"!
>
> I am using excel 2003 and i have tried all of the codes below with NO
> success:
>
> 1) Windows("file_name.xls").Activate
> ActiveWorkbook.Close (savechanges = False)
>
> 2) currentWorkbook.Close savechanges = False
>
> 3) Application.DisplayAlerts = False
> ActiveWorkbook.Close
>
> Nothing i have tried from previous articles has helped; any advice
> would be greatly appreciated.


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
explicitly name workbook and close without saving laavista Microsoft Excel Programming 2 15th Nov 2009 05:39 AM
Saving VBA project on workbook close =?Utf-8?B?RXJpYyBGaW5nZXJodXQ=?= Microsoft Excel Programming 4 18th Jul 2006 02:38 AM
Close a workbook without saving macros =?Utf-8?B?UGFwYSBKb25haA==?= Microsoft Excel Programming 12 27th Oct 2004 12:43 AM
Re: Close a workbook without saving macros J_J Microsoft Excel Discussion 3 27th Oct 2004 12:43 AM
Macro / close a workbook without saving carl Microsoft Excel Worksheet Functions 1 11th Nov 2003 12:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:37 PM.