General information
Category:
COM/DCOM and OLE Automation
I have two sheets open one that I want to copy from and paste to another worksheet.
I am able to copy the data to my clipboard and then when I try to past to my other sheet I want to start on Cell A4 but it keeps trying to past on cell A1 overwriting my data that I already have. I set my range on the sheet I would like to paste on to A4 but it don't work. Any ideas?
copy to c:\temp\final_report.xls type xl5
cFILE2='c:\temp\final_report.xls'
oBook2=OEXCEL.WORKBOOKS.OPEN(cFILE2)
oSheet2=oBook2.ActiveSheet
myrga = 'A1:AZ' + alltr(str(reccount()))
myrg = 'A2:AZ' + alltr(str(reccount()))
myrg2 = 'A4:AM' + alltr(str(reccount() + 5))
ORange2=osheet2.Range(myrg)
oSourceRange=osheet2.Range(myrg)
oSourceRange.Copy()
ORange=oSheet.Range("A4")
osheet.Paste()
oBook2.Close()
oSheet.Range(myrga).Columns.AutoFit()
Thanks,
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only