M
Matt
Can anyone provide code that will check for any open Excel files and close
all of them?
I use the code below, however I find sometimes the code does not always
close the designated Excel file which causes problems. This usually happpens
if I open another Excel file from Windows Explorer or do not properly run the
Close and Quit code from Access. I need someway to automatically close all
Excel processes to make sure the code runs properly.
Any suggestions
Private xls As Excel.Application
Private wk As Excel.Workbook
Set xls = New Excel.Application
xls.Visible = False
Set wk = xls.Workbooks.Open("c:\Excel.xls", True)
wk.Close True
xls.Quit
Set wk = Nothing
Set xls = Nothing
all of them?
I use the code below, however I find sometimes the code does not always
close the designated Excel file which causes problems. This usually happpens
if I open another Excel file from Windows Explorer or do not properly run the
Close and Quit code from Access. I need someway to automatically close all
Excel processes to make sure the code runs properly.
Any suggestions
Private xls As Excel.Application
Private wk As Excel.Workbook
Set xls = New Excel.Application
xls.Visible = False
Set wk = xls.Workbooks.Open("c:\Excel.xls", True)
wk.Close True
xls.Quit
Set wk = Nothing
Set xls = Nothing