' Change the sApp Variable to check the Application you needed
Sub Check_If_Application_Is_Open()
'Check if Instance of MS Word is Running in the machine
sApp = "Word.Application"
If IsAppRunning(sApp) = True Then
MsgBox "Application is Running"
Else
MsgBox "Application is NOT Running. Let me create my own"
' Create a new instance
Set oApp = CreateObject(, sApp)
End If
End Sub
' Generalized Function to Check if an Instance of Application is running in the machine
Function IsAppRunning(ByVal sAppName) As Boolean
Dim oApp As Object
On Error Resume Next
Set oApp = GetObject(, sAppName)
If Not oApp Is Nothing Then
Set oApp = Nothing
IsAppRunning = True
End If
End Function
' Generic Function to Check if Application is Running, Visual Basic GetObject, VBA GetObject, VB6 GetObject
Worked like a charm! Thank you so much...
ReplyDelete-Excel User, Bay Area, CA
yesss! it works for me.. =)
ReplyDeletebut, is it possible to check if the excel (or any other application) is not responding (application hang)? i have the macro to check the total time but i dont know how to determine if an application is not responding. thanks in advance..
hoping to get the answer asap.. thanks a lot ^_^
beautiful thanks for sharing ^^
ReplyDelete