ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening .XLS In VBA: Getting "Do You Want To Save..." Prompt... (https://www.excelbanter.com/excel-programming/411107-opening-xls-vba-getting-do-you-want-save-prompt.html)

(PeteCresswell)

Opening .XLS In VBA: Getting "Do You Want To Save..." Prompt...
 
-----------------------------------------------------------------
Dim myExcel As Excel.Application

Set myExcel = CreateObject("Excel.Application")

myExcel.Workbooks.Open myPath, UpdateLinks:=False, ReadOnly:=True

..
..
.. (MS Access VBA scrapes data from various worksheets)
..
..

set myExcel = Nothing
----------------------------------------------------------------

But I keep getting a "Do you want to save changes...." prompt.

What am I missing?
--
PeteCresswell

PeteCresswell[_2_]

Opening .XLS In VBA: Getting "Do You Want To Save..." Prompt...
 

What am I missing?


Sorry for trashing the NG... I think I found the obvious:

2990 With mySS
2991 .Application.DisplayAlerts = False
2992 .Workbooks(1).Close
2993 .Quit
2994 .Application.DisplayAlerts = True
2999 End With

Dave Peterson

Opening .XLS In VBA: Getting "Do You Want To Save..." Prompt...
 
Or

myss.workbooks(1).close savechanges:=false

And you shouldn't see the prompt.

PeteCresswell wrote:

What am I missing?


Sorry for trashing the NG... I think I found the obvious:

2990 With mySS
2991 .Application.DisplayAlerts = False
2992 .Workbooks(1).Close
2993 .Quit
2994 .Application.DisplayAlerts = True
2999 End With


--

Dave Peterson

(PeteCresswell)

Opening .XLS In VBA: Getting "Do You Want To Save..." Prompt...
 
Per Dave Peterson:
Or

myss.workbooks(1).close savechanges:=false

And you shouldn't see the prompt.


Thanks... that cleaned up my code by a few lines.... and maybe
whoever looks at it will actually think I know what I'm doing....
-)
--
PeteCresswell


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com