oSheet.cells(lnRow,x).value=laFields2[x,1]>I have a query that the number of fields returned is variable, so I've decided to make the printed version in Excel to handle variable number of columns (and their names). I have an array of the field names, so I was hoping I could just loop through them and set the values in the excel columns, problem is I'm not doing it right
>oExcel=CREATEOBJECT("Excel.Application") >oExcel.visible=.t. >oWorkbook=oExcel.Workbooks.add() >oSheet=oWorkbook.worksheets[1] >oSheet.Range("A1").value=ALLTRIM(thisform.cbo_userdept1.DisplayValue)+[ - Patient Check List] >oSheet.Range("A2").value=[CQI Solutions, Inc.] >lnFields=AFIELDS(laFields2) >lnRow=4 > >FOR x= 1 TO lnFields > oSheet.Range.cells(lnRow,x).value=laFields2[x,1] >ENDFOR >>