Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Spreadsheet functions
Message
From
18/10/2006 07:49:51
 
 
To
17/10/2006 16:34:55
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01162592
Message ID:
01162855
Views:
15
>>>For the first part:
>>>
>>>ox = CREATEOBJECT('Excel.Application')
>>>ob = ox.Workbooks.Open('YourWorkbook.xls')
>>>os1 = ob.Worksheets(1)
>>>os2 = ob.Worksheets(2)
>>>os3 = ob.Worksheets(3)
>>>
>>>Regards,
>>
>>Thanks Jim
>>
>>I can see that that references 3 worksheets within a book, but how to export my respective cursors into trhe 3 sheets?
>
>Off me memory:
>
>select cursor1
>_vfp.datatoclip(,,3)
>_cliptext=strtr(_cliptext, mline(_cliptext,1)+chr(13), "")
>os1.range("a1").select
>os1.selection.pastespecial()
>
>
>Repeat for the other two. When removing the header line, it may need cr+lf instead of just cr, don't remember.

Thanks Dragan

I tried you code, as below. It seemd a good idea BUT the data I'm dealing with is in humungous tables sometimes, like the etmdata table below. Several issues arose:
1) it took forever to fill _cliptext (as I imagined it would, given the size of the table)
2) I got some data in the w/s after the first ox.selection.pastespecial() (some 16K by the looks of it) but
os2.range("a1").select forced an OLE exception liek "Cannot access the range" (shoulda noted down, eh?)
3) the workbook failed to close (still left up as a procss in the TM, where I had to end it) and, when I looked in the w/w there was ziltch.

Nice idea but I don't know what to do about the problems. Looks like I'll need to do it in a loop, as Jim's suggestion.

Terry
LOCAL	ox  as Excel.Application
ox = CREATEOBJECT('Excel.Application')
ob = ox.Workbooks.Open('P:\FBVFP\book1.xls')
os1 = ob.Worksheets(1)
os2 = ob.Worksheets(2)
os3 = ob.Worksheets(3)

USE p:\fbvfp\officevfp\essexdata\etmdata.dbf In 0
select etmdata
_vfp.datatoclip(,,3)
_cliptext=strtr(_cliptext, mline(_cliptext,1)+chr(13), "")
os1.range("a1").select
ox.selection.pastespecial()
os2.range("a1").select
ox.selection.pastespecial()
ox.ActiveWorkBook.Close()		  
ox 	= NULL
RELEASE ox
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform