Solved

Late binding EXCEL Proceess stays active - VB6

Posted on 2006-07-20
3
603 Views
Last Modified: 2012-05-05
Problem - for a late binding EXCEL app (VB6), the process remains in the task mgr.
(Windows XP, EXCEL 2000, VB6)

First - here is a sequence that works fine.

set  xlsapp = CreateObject("EXCEL.APPLICATION")
xlsapp.quit
Set xlsapp = nothing

With this sequence, the EXCEL process is ended, as indicated by viewing the Windows Task Mgr.


Second - here is a sequence that does not work - the EXCEL process remains active as indicated by viewing the Task Mgr

set  xlsapp = CreateObject("EXCEL.APPLICATION")

rows("10").Select  'this type of statement results in the EXCEL process remaining active in the TaskMgr

xlsapp.quit
Set xlsapp = nothing

Do I need to do something with the "rows" or "Selection" properties before quiiting xlsapp?

Any help is greatly appreciated.  Thank you
0
Comment
Question by:cfwti
3 Comments
 
LVL 37

Expert Comment

by:Harisha M G
ID: 17149833
Hi,

It may be a good idea to close the workbook before quitting

---
Harish
0
 
LVL 11

Accepted Solution

by:
pratap_r earned 500 total points
ID: 17150105
This has something to do with how COM handles are referenced

Unless you release all references to the COM object it will not be unloaded from memory.

so instead of using
rows(10).select
you may need to do something like
set rows = xlapp.rows
...
set rows = nothing

please note that this has to be done to each and every reference. (To take the refcount back to 0)

hope this helps!

Enjoy!
Pratap
0
 

Author Comment

by:cfwti
ID: 17154339
Hi Pratap,

You certainly pointed me in the right direction.  The fix is shown below:

replace the the line of code --          rows(10).select

with  --           xlsapp.rows(10).select.

Apparantly, using the "rows" property (or any other application property) without the application prefix ("xlsapp.") creates an orphan.

Thanks,
cfwti
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now