Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel - Unable to get Paste property of Worksheet class
Message
From
11/06/2001 08:26:28
 
 
To
11/06/2001 03:53:45
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00513987
Message ID:
00517685
Views:
125
Daniel, thanks for the reply. Sadly the _CLIPTEXT and/or DataToClip() functionality will not work inside of a COM DLL. The nice thing about
pasting data from the clipboard is that I had the ability to use pre-existing
templates (formatting alreay complete) and drop the data to a specific
row and column inside a specific worksheet. For instance, I could have
7 worksheets (work1, work2, ... work7) and drop my data at row 3, column
5 inside of worksheet work2.

It was because of the great amount of flexibility that DataToClip or
_CLIPTEXT provided that I used that technique...

>Tom,
>If I interpret your code correctly, you're trying to export a VFP table to Excel. Instead of using the clipboard and pasting the data into Excel you could simply open() the exported file then SaveAs() an Excel file. This should also perform much better than using DataToClip(). Here are a couple of links that discuss this issue:
>
>- How to copy more than 16,383 records to Excel FAQ #8026
>- Export data from VFP to Excel and format worksheet in Excel Message #512100
>
>HTH
>
>>Looks like the Windows clipboard is NOT available from within a DLL.
>>
>>Back to the drawing board...
>>
>>>Cetin, even after the change you suggested I am still getting the following
>>>error:
>>>
>>>OLE IDispatch exception code 0 from Microsoft Excel: Unable to get the Paste property of the Worksheet class..
>>>
>>>SELECT c_sum2
>>>
>>>lcFile = SYS(2015)+".TXT"
>>>COPY TO (lcFile) DELIMITED WITH TAB
>>>_CLIPTEXT = FILETOSTR(lcFile)
>>>ERASE (lcFile)
>>>
>>>
>>>USE IN c_sum2
>>>
>>>WITH .oExcel.ActiveWorkBook.ActiveSheet
>>> .Range("A1").Select()
>>> .Paste()
>>>ENDWITH
>>>
>>>
>>>>>I should have also include that the error number was '800a01ad'
>>>>>
>>>>>>The following code works without any issue in a regular VFP Class:
>>>>>>
>>>>>> SELECT c_sum2
>>>>>> GO TOP
>>>>>> Application.DataToClip(,,3) && copy data to clipboard delimited with tabs
>>>>>> USE IN c_sum2
>>>>>> This.oExcel.Range("A1").Select()
>>>>>> This.oExcel.ActiveSheet.Paste()
>>>>>>
>>>>>>However the last line [.ActiveSheet.Paste()] creates the following
>>>>>>error when I run this thru a registered DLL:
>>>>>>
>>>>>> Error in line 161 OLE IDispatch exception code 0 from Microsoft Excel:
>>>>>> Unable to get the Paste property of the Worksheet class.. 429
>>>>>>
>>>>>>Any ideas on how this can be resolved? I tried both application.datatoclip()
>>>>>>and the _CLIPTEXT = FILETOSTR(file) techniques to no avail
>>>>
>>>>Tom,
>>>>What's this.oExcel ? Excel.Application or WorkBook, WorkSheet ?
>>>>In first line it sounds to be a worksheet :
>>>>This.oExcel.Range("A1").Select()
>>>>
>>>>These would work :
>>>>
application.datatoclip('customer',reccount(),3)
>>>>oExcel=createobject('Excel.Application')
>>>>with oExcel
>>>> .Workbooks.Add
>>>> with .ActiveWorkBook.Activesheet
>>>>  .Paste()              && Pastes at default A1 range
>>>>*  .Paste(.Range('B7')) && Paste starting from B7
>>>> endwith
>>>> .Visible=.t.
>>>>endwith
Cetin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform