ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Closing Excel in VBA (https://www.excelbanter.com/excel-programming/274472-re-closing-excel-vba.html)

Keith Willshaw

Closing Excel in VBA
 

"Bill" wrote in message
...
I'm having a great deal of difficulty getting Excel to
cease and desist after donating some of its data to an
Autocad drawing-
(Autocad 2000, Windows 2000)


Here are the declarations for reference:

Dim excelApp As Excel.Application
Dim wbkObj As Workbook


Here's my quit method (no changes are made to the excel
file, makes no difference whether I open read only or not):

excelApp.DisplayAlerts = False
wbkObj.Close
excelApp.Quit

Set wbkObj = Nothing
Set excelApp = Nothing

If I look at Windows task manager, EXCEL.EXE is still
listed in the processes window, and if I attempt to open
the xl file in explorer, excel hangs. If I force the
process to terminate through task manager, all returns to
normal. Somehow my app is simply unable to make excel go
away!

I know I've seen references to this problem before while
browsing the web, but for the life of me I haven't been
able to re-locate them.


This can happen if some object in Excel isnt released
If you have used any other object either inside or
external to Excel such as Worksheet, range or scripting object
ensure you release it by setting it to nothing.

Keith



Bill Tybring

Closing Excel in VBA
 
Thanks Paul & Keith- I finally got it. Keith was right, I still had an
obscure attachment. There was a Set Array pointing to the spreadsheet
that did not release with the Erase method (can't Set an array to
"Nothing" so was using erase).

Excel still stays in task manager but dissappears when the VBA project
is unloaded.

Bill



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 11:54 PM.

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