Results 1 to 8 of 8

Thread: Process ID

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2003
    Location
    Connecticut
    Posts
    6

    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!

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Did you call the Quit method of the Excel object? That should close it out.

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    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 .

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2003
    Location
    Connecticut
    Posts
    6
    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.

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    As another idea (never tried it) , start Excel object processing in another thread , when you're done , use abort to kill the process .

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Try setting the Excel object to nothing.

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2003
    Location
    Connecticut
    Posts
    6

    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!

  8. #8
    Addicted Member craigreilly's Avatar
    Join Date
    Jul 2004
    Location
    Scottsdale, AZ
    Posts
    188
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width