Can anybody please give me the code for the following;
I want to know if MS Word is running.
I want to know if MS Excel is running.
Thanks,
Graham.
Printable View
Can anybody please give me the code for the following;
I want to know if MS Word is running.
I want to know if MS Excel is running.
Thanks,
Graham.
Dim nHandle As Long
' If Excel is running this API call returns its handle.
nHandle = FindWindow("XLMAIN", 0) 'use "WINWORD" for Word
If nHandle = 0 Then ' 0 means Excel not running.
'do something here
End If
Thanks for the code but can I confirm..
Is 'FindWindow' a VB command or is it a C+ command as I am getting a Sub or Function not defined.
Thanks
Graham.
FindWindow is part of the Windows API:
Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As Long) As Long