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.

Re: How to copy a worksheet from one workbook to another in vb6 by Graham

Graham
Tue Sep 12 09:15:04 CDT 2006

You might do better in a visual basic - or at least an Excel group. This one
is for Word.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

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.



Re: How to copy a worksheet from one workbook to another in vb6 by Jean-Yves

Jean-Yves
Tue Sep 12 09:26:50 CDT 2006

Hi Spider
Wrong newsgroup
Try : microsoft.public.excel.programming

Workbooks("2.xls").activate
Worksheets("sheet2").Copy After:=Workbooks("1.xls").Worksheets("sheet1")
Be sure that all workbook name or sheet are correct
Regards
Jean-Yves


"SpiderSwamy" <manju_016@rediffmail.com> wrote in message
news:1158069925.476592.67940@h48g2000cwc.googlegroups.com...
> 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.
>



Re: How to copy a worksheet from one workbook to another in vb6 by SpiderSwamy

SpiderSwamy
Wed Sep 13 01:14:33 CDT 2006

Hi Thanks.
I will do that ..
:-)

Regards
Spider

Jean-Yves wrote:
> Hi Spider
> Wrong newsgroup
> Try : microsoft.public.excel.programming
>
> Workbooks("2.xls").activate
> Worksheets("sheet2").Copy After:=Workbooks("1.xls").Worksheets("sheet1")
> Be sure that all workbook name or sheet are correct
> Regards
> Jean-Yves
>
>
> "SpiderSwamy" <manju_016@rediffmail.com> wrote in message
> news:1158069925.476592.67940@h48g2000cwc.googlegroups.com...
> > 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.
> >