Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Datarange pastespecial problem
Message
De
30/06/2010 01:56:20
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Datarange pastespecial problem
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01471047
Message ID:
01471047
Vues:
115
Hi,

I keep getting an error - "unable to get the pastespecial property of the range class.." when I run my program. I am copying the contents of a table to the Windows clipboard, modifying it a little then, pasting it into a data range. Or, I should say I am trying to. My purpose ultimately is to copy values and not destroy the formulas that are already in place.

My apologies for the extra comments and any redundancy that is displayed. I have been working this problem for the past 3 days... it's a bit frustrating and I stopped being neat yesterday. :-)

Here's my code:


#DEFINE xlPasteAll -4104
#DEFINE xlPasteFormulas -4123
#DEFINE xlPasteValues -4163
#DEFINE xlNone -4142

TargetFile = "alldetail.xls"

* create Excel objects
loExcel = CREATEOBJECT("Excel.application")
loExcel.DisplayAlerts = .f.
loExcel.ScreenUpdating=.f.

loExcelWorkBook = loExcel.Application.Workbooks.Open(TargetFile)


SELECT alldetail && (table created by query)
* Export the contents of this file into the named range of the detail template "importdata"
GO top
IF NOT EOF()
loExcelWorkSheet = loExcelWorkBook.Worksheets("Sales and Use Tax")
loExcelRange = loExcelWorkSheet.range("importdata")

_VFP.DataToClip(,,3) && current table onto the clipboard, delimited with tab
mclip = _cliptext
mclip = SUBSTR(mclip,458) && trim field header names
mclip = STRTRAN(mclip,".NULL.")
mclip = thisform.trim_clipboard_text(mclip)
_cliptext = mclip

*previous attempts here:
* loExcelWorkSheet.range("importdata").pastespecial(-4163,-4142,.F.,.F.) && xlpastevalues
* loExcelRange.pastespecial(-4163,-4142,.F.,.F.) && xlpastevalues

* error occurs on this line of code:
loExcelRange.PasteSpecial(xlPasteValues)

endif



Thanks in advance for helping!!!

Paul
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform