A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Suppress "Do you want to save changes you made to ..." message.



 
 
Thread Tools Display Modes
  #1  
Old March 9th, 2010, 03:43 AM posted to microsoft.public.access
Perry
external usenet poster
 
Posts: 42
Default Suppress "Do you want to save changes you made to ..." message.

Everytime I try to close an opened excel sheet, I get the message
"Do you want to save the cahnges you made to ........."
How can I suppress the "warning" dialog?

set oOXL = createObject("Excel.Application")
oXL.Visible = False
oXL.workbooks.Open (Filename)
oXL.sheets("Inventory_1").select
....... processing, only reading no modification to sheet ......
oXL.workbooks.Close this triggers the message.
Set oXL = Nothing

Thanks.

  #2  
Old March 9th, 2010, 04:01 AM posted to microsoft.public.access
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Suppress "Do you want to save changes you made to ..." message.

"Perry" wrote in message
...
Everytime I try to close an opened excel sheet, I get the message
"Do you want to save the cahnges you made to ........."
How can I suppress the "warning" dialog?

set oOXL = createObject("Excel.Application")
oXL.Visible = False
oXL.workbooks.Open (Filename)
oXL.sheets("Inventory_1").select
...... processing, only reading no modification to sheet ......
oXL.workbooks.Close this triggers the message.
Set oXL = Nothing



I don't know, but it may just be that you changed the selection. I suspect
(without testing) that you may have to close the specific workbook, and tell
it not to save changes:

oXL.Workbooks(Filename).Close False
oXL.Workbooks.Close ' may not need this
oXL.Quit

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #3  
Old March 9th, 2010, 04:37 AM posted to microsoft.public.access
Perry
external usenet poster
 
Posts: 42
Default Suppress "Do you want to save changes you made to ..." message

Dirk,
Thank you. I still got the message. I've tried many different ways in the
last couple of hours but no success. I am using Office 2003.

  #4  
Old March 9th, 2010, 05:16 AM posted to microsoft.public.access
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Suppress "Do you want to save changes you made to ..." message

"Perry" wrote in message
...
Dirk,
Thank you. I still got the message. I've tried many different ways in the
last couple of hours but no success. I am using Office 2003.



How about setting the DisplayAlerts property to False?

oXL.DisplayAlerts = False
oXL.Workbooks.Close
oXL.Quit
Set oXL = Nothing

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #5  
Old March 9th, 2010, 05:18 AM posted to microsoft.public.access
Perry
external usenet poster
 
Posts: 42
Default Suppress "Do you want to save changes you made to ..." message

Dirk,
I created a short routine. I single cycle the code and found the "Subscript
out of range" error was posted.


set oOXL = createObject("Excel.Application")
oXL.Visible = False
oXL.workbooks.Open ("C:\test\test.xls")
oXL.sheets("test_1").select
oXL.WorkSheets("C:\test\test.xls").Close False error detected here.
' oXL.workbooks.Close
oXL.Quit


"Dirk Goldgar" wrote:

"Perry" wrote in message
...
Everytime I try to close an opened excel sheet, I get the message
"Do you want to save the cahnges you made to ........."
How can I suppress the "warning" dialog?

set oOXL = createObject("Excel.Application")
oXL.Visible = False
oXL.workbooks.Open (Filename)
oXL.sheets("Inventory_1").select
...... processing, only reading no modification to sheet ......
oXL.workbooks.Close this triggers the message.
Set oXL = Nothing



I don't know, but it may just be that you changed the selection. I suspect
(without testing) that you may have to close the specific workbook, and tell
it not to save changes:

oXL.Workbooks(Filename).Close False
oXL.Workbooks.Close ' may not need this
oXL.Quit

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #6  
Old March 9th, 2010, 05:28 AM posted to microsoft.public.access
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Suppress "Do you want to save changes you made to ..." message

"Perry" wrote in message
...
Dirk,
I created a short routine. I single cycle the code and found the
"Subscript
out of range" error was posted.


oXL.WorkSheets("C:\test\test.xls").Close False error detected
here.



That's not what I posted, and it couldn't possibly work. It would have to
be:

oXL.Workbooks("C:\test\test.xls").Close False

However, it might be that you have to use just the name of the workbook
file, not its full path:

oXL.Workbooks("test.xls").Close False

Or, it could be that you could avoid explicitly naming the workbook by
writing:

oXL.ActiveWorkbook.Close False


--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #7  
Old March 9th, 2010, 02:01 PM posted to microsoft.public.access
Perry
external usenet poster
 
Posts: 42
Default Suppress "Do you want to save changes you made to ..." message

Hello Dirk,

It works perfectly. Thank you.

"Dirk Goldgar" wrote:

"Perry" wrote in message
...
Dirk,
I created a short routine. I single cycle the code and found the
"Subscript
out of range" error was posted.


oXL.WorkSheets("C:\test\test.xls").Close False error detected
here.



That's not what I posted, and it couldn't possibly work. It would have to
be:

oXL.Workbooks("C:\test\test.xls").Close False

However, it might be that you have to use just the name of the workbook
file, not its full path:

oXL.Workbooks("test.xls").Close False

Or, it could be that you could avoid explicitly naming the workbook by
writing:

oXL.ActiveWorkbook.Close False


--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #8  
Old March 13th, 2010, 05:35 PM posted to microsoft.public.access
De Jager
external usenet poster
 
Posts: 393
Default Suppress "Do you want to save changes you made to ..." message.


"Perry" wrote in message
...
Everytime I try to close an opened excel sheet, I get the message
"Do you want to save the cahnges you made to ........."
How can I suppress the "warning" dialog?

set oOXL = createObject("Excel.Application")
oXL.Visible = False
oXL.workbooks.Open (Filename)
oXL.sheets("Inventory_1").select
...... processing, only reading no modification to sheet ......
oXL.workbooks.Close this triggers the message.
Set oXL = Nothing

Thanks.


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:15 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.