Hello all,
When trying ro execute my program I get the mess "Sub or function not
defined"
The highlighted word is: "FindWindow"
Could somebody tell me which item I have to reference in the reference list?
Any help very much appreciated...
Thanks
Ronny
Public Function DetectExcel()
' Procedure dectects a running Excel and registers it.
Const WM_USER = 1024
Dim hWnd As Long
' If Excel is running this API call returns its handle.
hWnd = FindWindow("XLMAIN", 0)
If hWnd = 0 Then ' 0 means Excel not running.
Exit Function
Else
' Excel is running so use the SendMessage API
' function to enter it in the Running Object Table.
SendMessage hWnd, WM_USER + 18, 0, 0
End If
End Function