I am creating an object for Excel using Automation and am trying to determine when the user close/quits excel.
I have it working for Word but I am having problems getting it working for Excel. Below is what works for Word.
* --- Define WinApi Functions
DECLARE integer GetForegroundWindow in WIN32API
DECLARE short IsWindow in WIN32API integer
oWord = CreateObject("Word.Application")
oWord.Visible = .T.
oWord.Activate()
lnWordWindow = GetForegroundWindow() && Save word window handle
If Type("oWord") = "O" And Not IsNull(oWord)
&& Loop while Word Window Active
Do While IsWindow(lnWordWindow) # 0
EndDo
&& User has Closed Word Session
Release oWord
Release oDocument
EndIf
Thanks for the help
Here is what I am trying for Excel.
DECLARE integer GetForegroundWindow in WIN32API
DECLARE short IsWindow in WIN32API integer
oExcel = CreateObject("Excel.Application")
oExcel.Visible = .T.
lnExcelWindow = GetForegroundWindow() && Save excel window handle
If Type("oExcel") = "O" And Not IsNull(oExcel)
Do While IsWindow(lnExcelWindow) # 0
EndDo
Release oExcel
EndIf
Eddie McCandless