Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
Datarange pastespecial problem
Versions des environnements
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement