Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Export data to Excel file (using template)
Message
 
 
To
28/05/2001 17:31:42
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00511978
Message ID:
00512053
Views:
21
>you wrote...
>
>> I use OLE Automation - open the template, save it to a new name and then walk > through the cursor putting the data into the template.
>
>I think I can open the template using OLE Automation, but what are the commands
>I have to use to '...walk through the cursor putting the data into the template' / if I do not use a macro in Excel, I mean all the code in VFP side ?

Would the following help get you started?
local lcXLFile, ox
lcXLFile = getfile("Excel Files:XLS")
if empty(lcXLFile)
	return .f.
endif
use MyTable
ox=createobject("excel.application")
ox.Workbooks.Open(lcXLFile)
for i = 1 to reccount('MyTable')
    with ox.sheets(1)
       .cells(i,1).value = MyTable.Field1
       .cells(i,2).value = MyTable.Field2
       .cells(i,3).value = MyTable.Field3
       .cells(i,4).value = MyTable.Field4
    endwith
    skip
next
ox.quit
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform