by citeaux on May 3rd, 2007

citeaux

Question

Help answer this question below.

Hi,
How could I check if Excel Object is running, so that I can kill/close the excel object before I run my functions. Else I got to manually delete it by using the CTRL+ALT+DEl and lool for EXCEL to delete the process. Kindly Help. Thanks

  • Like
  • Report

Answers. Showing one answer.

  • by Fuzzzy on June 25th, 2007

    Fuzzzy

    You can always cause each running instance of Excel to close when you are done with it by calling the Excel.Application.Quit() method. But what if it is already running?

    To allow for the reuse of existing instances of objects, VBA provides the GetObject() method. Calling GetObject with the name of an object or application as its second parameter (the first argument PATH NAME is optional) will return the instance of the object that is already running, into your object variable.

    For example:

    Public Sub GetExcel()
    On Error Resume Next
    Dim objExcel As Excel.Application

    Set objExcel = GetObject(, "Excel.Application")

    objExcel.Quit

    End Sub

    [ Source: VBA Programmer's Reference, Wrox Books ]

    Comments
    • Like
    • Report

    No comments. Post one | Permalink

Want to attach an image to your answer? Click here.

Did this answer your question? If not, then ask a new question or create a poll.

More Questions. Additional questions in this category.

You're reading Hi, How could I check if Excel Object is running, so that I can kill/close the excel object before I run my functions. Else I got to manually delete it by using the CTRL+ALT+DEl and lool for EXCEL to delete the process. Kindly Help. Thanks

Follow us on Facebook!

Related Ads