************************************************** *-- Class: excelcaller (c:\temp\test.vcx) *-- ParentClass: commandbutton *-- BaseClass: commandbutton * DEFINE CLASS excelcaller AS commandbutton Height = 27 Width = 84 Caption = "Launch Excel" Name = "excelcaller" PROTECTED PROCEDURE findwindowclass lparameters tcWintitle DECLARE integer FindWindow in WIN32API string cNull, string cWinName declare integer GetClassName in WIN32API integer hWnd, string @cClass, integer nMaxBuffer hWnd = FindWindow(0,tcWintitle) lpClassName = space(200) nBufLen = GetClassName(hWnd,@lpClassName,200) clear dlls return substr(lpClassName,1,nBufLen) ENDPROC PROTECTED PROCEDURE findwindowhandle lparameter tcWinClass DECLARE integer FindWindow in WIN32API string cNull, string cWinName nHWND = FindWindow(tcWinClass,0) clear dlls return nHWND ENDPROC PROCEDURE Click Public oExcel oExcel = GetObject('','excel.sheet') for ix = 1 to 20 tcWaitWindowClass = this.findwindowclass("Microsoft Excel") if !empty(tcWaitWindowClass) exit endif endfor oExcel.Application.Visible = .t. do while this.findwindowhandle(tcWaitWindowClass)<>0 enddo release oExcel ENDPROC ENDDEFINE * *-- EndDefine: excelcaller **************************************************Cetin