Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close Excel automatically from Access

Status
Not open for further replies.

alexisb

Programmer
Apr 5, 2001
100
US
After my load is done, Excel is still running when I check the task manager and is eventually hanging my PC. Just the workbook is being closed but I want to quit Excel. I have the following code:

xlApp.Application.Workbooks.Close
xlApp.Quit

I did a keyword search in the Access forums and thought I found that I could add a parm -1 after the close but then I get an error "subscript out of range". Any ideas?

Thank you.


 
I've had this same problem and found that just closing Excel is not enough, You have to set every Excel object to nothing first. This includes every range, picture, shape, etc.

Also, if you use the range object it makeas a difference how you use it. You must use

wks.Range(wks.Cells(1, 1), wks.Cells(12,100))

and not

wks.Range(Cells(1, 1), Cells(12,100))

Good luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top