I try to use
oExcel := CreateObject( "Excel.Application" ) , followed with
oExcel:WorkBooks:Add()
oAs := oExcel:ActiveSheet()
After making it visible (oExcel:Visible := .T.) , the user can close aplication or return to the aplication without closing it.
I noticed that excel is executed with caption .... MAP1 ...
Next code can detect that excel is not closed , but closing it fails :
- Code: Select all Expand view RUN
hWnd := FINDWND( "MAP1" )
IF !EMPTY( hWnd )
SENDMESSAGE( hWnd, 16 )
//CloseWindow(hWnd)
END
#define GW_HWNDNEXT 2
#define GW_CHILD 5
FUNCTION FINDWND( cTitle )
LOCAL hWnd := GETWINDOW( GETDESKTOPWINDOW(), GW_CHILD )
WHILE hWnd != 0
IF UPPER( cTitle ) $ UPPER( GETWINDOWTEXT( hWnd ) )
RETURN hWnd
ENDIF
hWnd = GETWINDOW( hWnd, GW_HWNDNEXT )
ENDDO
RETURN NIL
How can excel be closed ?
Must the object oExcel released ? How
Frank