-
Process ID
I am using Visual Basic .NET to create a program that instantiates an Excel application object. How do I retrieve the Process ID of this instance of Excel?
The reason I am asking this is because there seems to be a problem with Visual Basic .NET when trying to detroy an Excel object. It would not close it properly, and therefore leaves the application open without a window in the TaskBar. If I can retrieve the Process ID of the Excel application instance I create in code, then perhaps I can kill it via code also.
Thanks in advance!
-
Did you call the Quit method of the Excel object? That should close it out.
-
As Edneeis said , Close method should work . Get the current process , I think , will not show any info about inner object that your process creates . But , you can try the combination of Close and GC.Collect which fires the Garbage Collector at once .
-
Quit will close the application on the front-end, but the Excel process is still running under the Task Manager.
We tried using the GC.Collect method, but to no avail. I thought it's suppose to prompt the Garbage Collector to clean up all the unused objects immediately, but that doesn't seem to be the case.
Thanks for the advice though.
-
As another idea (never tried it) , start Excel object processing in another thread , when you're done , use abort to kill the process .
-
Try setting the Excel object to nothing.
-
Process ID [RESOLVED]
Thanks for all the advice. I'll let you know what happens. I'm going to try using another thread to start Excel.
Take care!
-
what is the best way to do this. I to get the same thing. I do not want to quit the app because the user might need to add notes or maniplate the data. How else does vb.net release hold of the app without quitting (and setting 'oxl=nothing' does not work)
Thanks.