By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,202 Members | 1,341 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,202 IT Pros & Developers. It's quick & easy.

In Access Automation, Instance of Excel cannot be destroyed.

P: n/a
I am running:
Win XP SP2
Excel 2002, Access 2002 (Office XP SP3)
Using Visual Basic (not VB.NET)

At one point (prior to XP SP2?!? - I can't pin it down), this did
not happen and I was easily able to destroy instances of excel (with
the exact same code). I have read many, many posts, and they seem to
get bogged down in specifics. So I cribbed this program from the
automation help file, simplified it further, so hopefully someone can
steer me to the root causes of this.

Two versions of code, one that works just fine, and the other that
leaves a hanging instance of excel that can only be removed by ending
the EXCEL.EXE process from the task manager.

Sub WorksFine()

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook

Set xlApp = CreateObject("Excel.Application")

xlApp.Visible = True

' It Seems to be the process of opening a workbook
' that is causing the problems
' -this also happens with
' xlbook = xlApp.Workbooks.Open("C:\Book1.xls))
'
' Set xlBook = xlApp.Workbooks.Add()
' xlBook.Worksheets(1).Cells(1, 1).Value = "Hello"
' xlBook.SaveAs "C:\Book1.xls"
' xlBook.Close
Set xlBook = Nothing

xlApp.Quit
Set xlApp = Nothing

End Sub
This next sub leaves an instance of excel hanging in the background.
This instance can be made visible by typing
"Excel.Application.Visible=True" in the immediate window.
However, "Excel.Application.Quit" in the immediate windown merely
returns it to its invisible status- does not remove EXCEL.EXE from the
list of processes.

Sub WhatTheHeck()

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook

Set xlApp = CreateObject("Excel.Application")

xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Add()
xlBook.Worksheets(1).Cells(1, 1).Value = "Hello"
xlBook.SaveAs "C:\Book1.xls"
xlBook.Close
Set xlBook = Nothing

xlApp.Quit
Set xlApp = Nothing

End Sub

I have come across many suggestions, but none seem to be applicable.

The symptoms are described in several kb articles.
This one describes the symptoms quite well:
XL2000: Automation Doesn't Release Excel Object from Memory
http://support.microsoft.com/default...b;en-us;199219
Thanks for any help!

Taylor

Nov 13 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
On 18 Jan 2005 19:59:52 -0800, ta***********@gmail.com wrote:
I am running:
Win XP SP2
Excel 2002, Access 2002 (Office XP SP3)
Using Visual Basic (not VB.NET)

At one point (prior to XP SP2?!? - I can't pin it down), this did
not happen and I was easily able to destroy instances of excel (with
the exact same code). I have read many, many posts, and they seem to
get bogged down in specifics. So I cribbed this program from the
automation help file, simplified it further, so hopefully someone can
steer me to the root causes of this.

Two versions of code, one that works just fine, and the other that
leaves a hanging instance of excel that can only be removed by ending
the EXCEL.EXE process from the task manager.

Sub WorksFine()

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook

Set xlApp = CreateObject("Excel.Application")

xlApp.Visible = True

' It Seems to be the process of opening a workbook
' that is causing the problems
' -this also happens with
' xlbook = xlApp.Workbooks.Open("C:\Book1.xls))
'
' Set xlBook = xlApp.Workbooks.Add()
' xlBook.Worksheets(1).Cells(1, 1).Value = "Hello"
' xlBook.SaveAs "C:\Book1.xls"
' xlBook.Close
Set xlBook = Nothing

xlApp.Quit
Set xlApp = Nothing

End Sub
This next sub leaves an instance of excel hanging in the background.
This instance can be made visible by typing
"Excel.Application.Visible=True" in the immediate window.
However, "Excel.Application.Quit" in the immediate windown merely
returns it to its invisible status- does not remove EXCEL.EXE from the
list of processes.

Sub WhatTheHeck()

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook

Set xlApp = CreateObject("Excel.Application")

xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Add()
xlBook.Worksheets(1).Cells(1, 1).Value = "Hello"
xlBook.SaveAs "C:\Book1.xls"
xlBook.Close
Set xlBook = Nothing

xlApp.Quit
Set xlApp = Nothing

End Sub

I have come across many suggestions, but none seem to be applicable.

The symptoms are described in several kb articles.
This one describes the symptoms quite well:
XL2000: Automation Doesn't Release Excel Object from Memory
http://support.microsoft.com/default...b;en-us;199219
Thanks for any help!

Taylor

Hi

Try not declaring xLBook but writing out everything in full on each
line, that way you avoid creating any more references for automation
to lose track of.
Just an idea
David

Nov 13 '05 #2

P: n/a
I'll give it a shot and let you know.

Nov 13 '05 #3

P: n/a
I tried everything, and it was all very frustrating and getting out of
hand- Until I stumbled across another post (so easy to miss) wherein a
person commented that they had initiated a tech support session with
microsoft based on the similar problem, and they had tracked it down to
Google Desktop!

He uninstalled, it went away. I uninstalled my Google desktop, lo and
behold Ta Daa! I can kill instances at will!

Yay, thanks for the suggestions.

Taylor

P.S. I am not sure of the protocol for linking, but here is a cut n'
paste of his response:
Microsoft analyzed this for me and determined
that the problem was caused by the Google Desktop
Search Office Addin: A COM add-in is initially loaded
and assigns the reference to Excel or one of its
members to a global object, the reference isn't
released so Excel continues to be a loaded process.
This is what is happening when Google Desktop Search
tool is installed. This tool doesn't release the
object reference to the document (workbook).

I uninstalled Google Desktop Search and the problem
went away.

I have provided this description to Google Desktop Feedback.


Nov 13 '05 #4

P: n/a

THANK YOU! THANK YOU! THANK YOU!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5

P: n/a

THANK YOU! THANK YOU! THANK YOU!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #6

P: n/a
I am saved! May the fleas of a thousand camels infest your enemies'
testicles!!!!

I just had the same problem on a client's Windows XP computer (Access
2K). Tried for 2+ hours to unhang that danged instance, with no luck.
After reading your post, I just tried the same code on my own Windows
XP/Access 2K machine and Excel instance did NOT hang.

I am 99.99999% sure my client doesn't have Google desktop on that
machine (installing something like that is a firing-squad offense at
the company), so I don't think it's just Google. Will compare Windows
settings tomorrow to see what the difference is.

Thank you, thank you, thank you.

Krysa

Nov 13 '05 #7

P: n/a
This just in.... When I had the tech support folks update my client's
PC with Office Service Pack 3, the problem disappeared. We're not 100%
sure it was this Service Pack, because they also installed a number of
Windows XP updates (not SP-2, though) at the same time, but it would
seem the Office service pack is the more likely candidate.

I might note that Microsoft's suggestion not to use the "With"
structure (see KB 199299 link in original poster's message) did not
solve the problem.

So go forth and update!

Cheers,

Krysa

Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.