Solved

Late binding EXCEL Proceess stays active - VB6

Posted on 2006-07-20
3
636 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
This is about my first experience with programming Arduino.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 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