Copying aenother workbook's sheets
In VBA in Excel 2003, I'm trying, from within one workbook, to open
another workbook, copy one sheet, and past it into sheet 3 of the
calling workbook. I believe I did it something like this:
Dim wbTarget AS Workbook
Set wbWorkbook = "somepath\somesheet.xls".open
wbWorkbook.sheet3.activate
wbWorkbook.sheet3.select
wbWorkbook.sheet3.copy
wbWorkbook.close
ThisWorkbook.sheets(3).activate
ThisWorkbook.sheets(3).cells(1,1).select
ThisWorkbook.sheets(3).cells(1,1).paste
Now, this is from memory of what I left off doing Friday afternoon, so I
may be a bit off. I believe that I had set s string variable to hold
the contents of the COPY operation, but when it was pasted into sheet3
of the calling workbook, all I ended up with was the variable name
itself pasted into the last cell of the copy area - and nothing else.
In other words, all I saw was something like the value strSource in cell
(10, 50) with all other cells on sheet3 blank. Since this is neither
very useful nor what I'm trying to do, I could use a push in the right
direction. My thanks in advance.
Henry
DPM Mellon
|