Determine if an application is available using VBA in Microsoft Excel

To find out the status of any particular application available or running in Microsoft Excel, take a look at this article. We will use VBA code to check to return “True”, if the application is available or running or return and “False” if not.

 

Question: I would like to have a macro to identify in background whether the specific application is running or available/installed in the system.

 

To identify the Outlook application is running or available; we need to follow the below steps to launch VB editor:

  • Click on Developer tab
  • From Code group select Visual Basic

image 1

 

  • Click on Insert then Module

image 2

 

  • This will create new module
  • Enter the following code in the Module

 

Function ApplicationIsRunning(ApplicationClassName As String) As Boolean
' returns True if the application is running
' example: If Not ApplicationIsRunning("Outlook.Application") Then Exit Sub
Dim AnyApp As Object
  On Error Resume Next
  Set AnyApp = GetObject(, ApplicationClassName)
  ApplicationIsRunning = Not AnyApp Is Nothing
  Set AnyApp = Nothing
  On Error GoTo 0
End Function

 

Function ApplicationIsAvailable(ApplicationClassName As String) As Boolean
' returns True if the application is available
' example: If Not ApplicationIsAvailable("Outlook.Application") Then Exit Sub
Dim AnyApp As Object
  On Error Resume Next
  Set AnyApp = CreateObject(ApplicationClassName)
  ApplicationIsAvailable = Not AnyApp Is Nothing
  Set AnyApp = Nothing
  On Error GoTo 0
End Function

 

image 3

 

  • In any cell you need to enter formula as follows to check if Outlook Application is installed on the pc
  • =ApplicationIsAvailable(“Outlook.Application”)

image 4

 

  • To determine if Outlook Application is currently running or not; in any cell enter the formula as  =ApplicationIsRunning(“Outlook.Application”)

image 5

 

Conclusion: This way we can check the status of specific application is install & whether it’s running or not.

 

image 48

 

If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.

We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at info@exceltip.com

 
 

Users are saying about us...

  1. Thanks for the post. I learned how to determine if a specific MSO App is running, but now I would like to determine if a specific third party program like “SAP” or “Primavera 6″ or “AUTOCAD” etc is available to run.

    Background: A list box will be generated based on the available programs on the users PC. The user will be able to pick from this list which programs (as well as webpages, files and or folders) they want opened when Excel starts… any help would be appreciated + thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Visit Us On TwitterVisit Us On FacebookVisit Us On Google PlusVisit Us On Youtube