Hi,
Horodyski Marek (PZUZ) wrote:
I try modify opened excel sheet, but this code : Local oExcel, oAs if ( oExcel := win_oleCreateObject( "Excel.Application" )) == Nil ok( 'Error ...') Return end cls * oExcel:WorkBooks:Add() // <-- when I uncommet this line, all is ok oAS := oExcel:ActiveSheet() ? valtype( oas) inkey( 0) return Is displaed 'U'. This code was work in xHarbour.
I do not thing so, or xHarbour has hacked OleCreateObject to do OleGetActiveObject() before real OleCreateObject call.
How can I catch active sheet ?
Win_oleCreateObject("Excel.Application") create a new Excel object without any open documents (i.e. workbook), so it is unable to have active sheet.
I successfully use code: oExcel := Win_OleGetActiveObject("Excel.Application") IF !EMPTY(oExcel); oSheet := oExcel:ActiveSheet() ENDIF IF EMPTY(oSheet) .OR. EMPTY(oSheet:Cells(1, 1):Value) ? "Please, open not empty data file in Excel" RETURN .F. ENDIF ... Regards, Mindaugas _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour