Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE Automation with Excell
Message
From
26/07/1999 11:21:07
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00245863
Message ID:
00246091
Views:
18
>>I can't use a table and save to excel because there are too many columns and the nature of the data would make it difficult to build several tables and link them together. I am using the with clause extensively but it is the oXLWorkSheet.cells(x,y).value='...' that seems to eat the time.
>
>Then you will have to create a file that excel can read in such as coma delimited. This is unfortunate because of the time it will take to create the file, but overall will be quicker than writing the data one cell at a time.
>
>Here's the sample code to use the clipboard to cut and paste
>
>*data to excel using cut & paste
>
>_VFP.DataToClip(,,3) &&To read data from table
>
>*In your case you will have to build the data and put into clipboard using
>*_CLIPTEXT. Seperate columns with tabs and rows with CR's.
>
>_CLIPTEXT ="HELLO"+chr(9)+"THERE"+chr(13)+"ROW 2"+chr(9)+"DATA"
>
>oExcel = Create("Excel.Application")
>oExcel.Workbooks.Add()
>oRange = oExcel.Range("A1:B2")
>oRange.PasteSpecial()
>oExcel.Visible = .T.

You can actually push this a little further:

lcClip=""
scan for RecordShouldGoToExcel
* assuming you exports two string, a number and a date
lcClip=lcClip+field1+chr(9)+field2+chr(9)+str(field3)+chr(9)+dtoc(field4)+chr(13)
endscan
_cliptext=lcClip
oExcel=....etc, proceed as before. This way you paste the whole table in one move.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform