Closing invoked XL app from PJ

M

Marshall

Hi,

I've made a PJ user form to allow an excel report of
timescaled date for specified resource groups. After
choosing the groups to include, a click event opens
Excel, adds a new workbook, and writes out to it.

The problem is what next...

If I close the instance of Excel (2000) from PJ (2002
prof) and release the object (set appxl = nothing), I
find that the XP Task Manager shows that the Excel app
(as viewed in the Task Manager 'Applications' tab) has
been closed, but the associated process (excel.exe - in
the 'Processes' tab) is still running. This results in
object errors (runtime 1004 method Range of object
_Application failed) if the same PJ code is run a second
time (despite working perfectly - apart from not
releasing the process! - the first time).

Killing the process manually from the Task Manager allows
the code to run through a second time with no probs.
Hitting the STOP button on the vb debugger also releases
the process (even if the form has already been unloaded
and the code has finished running - weird). But I
obviously don't want users to have to do either of
these...

I would actually prefer to be able to leave the created
Excel sheet and/or the Excel app itself open and run the
code from the click event again, but this too produces
object errors

Any ideas on what I'm doing wrong?
 
J

Jan De Messemaeker

Hi,

I'm afraid it's the Excel lab that has done things wrong, this problem has
been in existence for ages and no solution is in sight.

You can try the following:

- The SUREST solution, though drastic, is at the end of your procedure to
close the MS Project application as well. This makes the "parasite"
Excel.exe task go away. I do this whenever I can;

- I've had some success with putting the Excel Application = Visible before
closing it but I dare not swear it works all the time.

HTH
 
M

Marshall

Thanks for this. I suspected as much... Have posted
another query re being able to run a batch file to kill
the process manually...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top