View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] dave.mclachlan@gmail.com is offline
external usenet poster
 
Posts: 3
Default How to copy a worksheet from one workbook to another in vb6

try... with quotes in the workbooks object....

Workbooks("2.xls").Worksheets("sheet2").Copy _
After:=Workbooks("1.xls").Worksheets("sheet1")




SpiderSwamy wrote:
Hi All,

I have 2 workbook(i.e. 1.xls & 2.xls) at 2 different location, I want
to copy all the worksheets present in 2.xls to 1.xls file using vb6.

I am trying to open both the files and then trying with this code...

Workbooks(2.xls).Worksheets("sheet2").Copy _
After:=Workbooks(1.xls).Worksheets("sheet1")

I am getting "subscript out of range" error.... can u plz help me...

Thanks in Advance.