Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Populating column headers
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Excel Populating column headers
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01267122
Message ID:
01267122
Views:
56
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 
The single line inside the loop bombs with an OLE invalid number of parameters message.

Thanks for any help.

Kirk
Next
Reply
Map
View

Click here to load this message in the networking platform