Try this:
Code:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long Private Sub Command1_Click() Retval = FindWindow("XLMAIN", 0&) If Retval = 0 Then MsgBox ("Excel is not running") Else MsgBox ("Excel is running") End If End Sub




Reply With Quote