Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass an array to MS Excel with automation
Message
From
03/09/2002 12:41:19
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Pass an array to MS Excel with automation
Miscellaneous
Thread ID:
00696285
Message ID:
00696285
Views:
60
Anyone know how to set the value of a range object in Excel from an array in VFP?
I made a wrapper class 'icgxl' to make my life easier. oMyXl.oleApp corresponds to the Excel.Application object reference.
The commented line at the bottom gets a syntax error.
With further messing around, I found out that if I do this:
oMyXl.oleApp.Range(lcRangeString).Select
1st, then it does not get a syntax error, but instead, fills the range with all values of '10001'
LOCAL lnRowCount, lnColumnCount, lcRangeString

USE l:\boowned\surface\main0001 IN 0 ALIAS main

SELECT wcode, tnum, tname, st, county, acct ;
FROM main INTO cursor mysheet;
WHERE class NOT like 'D__';
AND class NOT like 'N__'

SELECT mysheet
lnColumnCount = FCOUNT()
lnRowCount = RECCOUNT()
lcRangeString = 'A1'+':'+getletter(lnColumnCount)+ALLTRIM(STR(lnRowCount))
COPY TO ARRAY myarray

DEBUG 
SUSPEND 

oMyXl = CREATEOBJECT("icgxl")
oMyXl.Visible(.T.)
oMyXl.CreateSheet(" ")
oMyXl.oleApp.Worksheets("sheet1").Activate()
*oMyXl.oleApp.Range(lcRangeString).Value = @myarray
Jim Newsom
IT Director, ICG Inc.
Next
Reply
Map
View

Click here to load this message in the networking platform