Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pass an array to MS Excel with automation
Message
De
03/09/2002 12:41:19
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Pass an array to MS Excel with automation
Divers
Thread ID:
00696285
Message ID:
00696285
Vues:
59
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform