Question : How do I cut/copy and paste in Excel by Visual Foxpro OLE?
I am trying to copy/cut and paste in Excel by controlling it via Foxpro. I can cut successfully, and then I get an error: OLE error code 0x80020006: Unknown name.
Code Snippet:
1: 2: 3: 4: 5: 6: 7: |
oExcel=Createobject("Excel.Application") oExcel.Visible = .T. oworkbook=oExcel.Application.Workbooks.Open(m.file1) with oworkbook.ActiveSheet .Range("C3:D4").Cut .Range("C2:D3").Paste &&this is where the program stops endw |
Solution: How do I cut/copy and paste in Excel by Visual Foxpro OLE?
This is how to cut or copy
xlsheet.Range(cRange).Select
xlapp.Selection.Copy
You select the new cell and then paste.
WITH oworkbook.ActiveSheet
.Range(“C2:D3”).Select
.Paste
ENDWITH