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 workbook without saving file

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Close workbook without saving file

Hi Kent,

In the 'This Workbook' object:

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

Cheers,
JF.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Close workbook without saving file

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



" 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.



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

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, 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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Close workbook without saving file

maybe this

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

Mike

" 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.





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

you need a colon before the equals sign

Workbooks(fname).Close savechanges:=False

--

Gary
Excel 2003


wrote in message
...
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.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Close workbook without saving file

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)



wrote in message
...
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
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 file without saving Mike Excel Programming 1 December 5th 07 02:15 AM
Saving VBA project on workbook close Eric Fingerhut[_3_] Excel Programming 4 July 18th 06 02:38 AM
Close a workbook without saving macros Papa Jonah Excel Programming 12 October 27th 04 12:43 AM
Close file without saving Roadie[_4_] Excel Programming 0 October 22nd 04 03:21 PM
Close file without saving Roadie[_3_] Excel Programming 1 October 22nd 04 02:53 PM


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