Article ID: 132375
Article Last Modified on 6/11/2007
'Declare the Windows API function "GetModuleHandle"
Declare Function GetModuleHandle Lib "KERNEL" (ByVal App As String) _
As Integer
Sub IsAppRunning()
Dim Response As Integer
'Call the GetModuleHandle function to determine if Microsoft
'Word is currently running
Response = GetModuleHandle("Winword")
'If Response is 0, then Word is not running. If Response is
'nonzero, then Word is running.
If Response = 0 Then
MsgBox "Application is not running"
Else
MsgBox "Application is running"
End If
End Sub
The GetModuleHandle function will return a zero if the specified
application is not running and a nonzero value if the specified application
is running.
Additional query words: open XL5
Keywords: kbcode kbprogramming kbusage KB132375