Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Late binding EXCEL Proceess stays active - VB6

Posted on 2006-07-20
3
Medium Priority
?
645 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 1500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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 make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…
Six Sigma Control Plans

618 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