It returns the message that Excel is not available when using Harbour / MSVC 2010 / FWH 12.04
- Code: Select all Expand view
FUNCTION ARToXls( aCodes, cTitle )
*-----------------
LOCAL oExcel, oAS
LOCAL nRow, nCol, aStruct, i
LOCAL nACnt := LEN( aCodes )
nRow := nCol := nCtr := 0
// Create the object
oExcel := CreateObject( "Excel.Application" )
IF Ole2TxtError() != "S_OK"
ALERT ( "ERROR! Excel not available." )
RETURN
ENDIF
oExcel:WorkBooks:Add( )
oAS := oExcel:ActiveSheet( )
oAS:Cells:Font:Name := "MS Sans Serif"
oAS:Cells:Font:Size := 10
oAS:Cells( 1, 1 ):Value := "Company "
oAS:Cells( 1, 2 ):Value := "Current "
oAS:Cells( 1, 3 ):Value := "Begin Bal."
oAS:Cells( 1, 4 ):Value := "January "
oAS:Cells( 1, 5 ):Value := "February "
oAS:Cells( 1, 6 ):Value := "March "
oAS:Cells( 1, 7 ):Value := "April "
oAS:Cells( 1, 8 ):Value := "May "
oAS:Cells( 1, 9 ):Value := "June "
oAS:Cells( 1, 10):Value := "July "
oAS:Cells( 1, 11 ):Value := "August "
oAS:Cells( 1, 12 ):Value := "September "
oAS:Cells( 1, 13 ):Value := "October "
oAS:Cells( 1, 14 ):Value := "November "
oAS:Cells( 1, 15 ):Value := "December "
FOR nRow := 1 TO nACnt
oAS:Cells( nRow+1, 1 ):Value := aCodes[nRow][1]
FOR i := 2 TO 15
oAS:Cells( nRow+1, i ):Value := STR( aCodes[nRow][i], 12, 2 )
NEXT
NEXT
FOR i = 1 to nACnt
oAS:Columns( i ):AutoFit()
NEXT
oExcel:Visible := .T.
oExcel:ActiveWorkbook:SaveAs( cTitle )
oExcel:ActiveWindow:Close()
oExcel:Quit()
MsgInfo( cTitle + " has been created in your document folder" )
RETURN
I have had other problems with Active X operations using Harbour 3.0 and FWH 12.
Any thoughts on this problem ?
Thanks.
Tim