View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bill Li Bill Li is offline
external usenet poster
 
Posts: 46
Default Workbooks when to use

Hi Milos,

Maybe when you create the new sheet, the activeworkbook is
prog.xls or you use thisworkbook function. Could you post
the code so that we can analysis?

Best Regards

Bill


-----Original Message-----
Hi all,

I am bit confused.

I have a workbook with a VBA program called prog.xls that

I try to do the
following with

open a file file.xls using workbooks.open

filename:=file.xls

and then open file1.xls copy a chunk of data
activate file.xls using workbooks(file.xls).activate
create a new sheet with name file1 and then paste the

chunk of data
there using range("A1").select and activesheet.paste.

But it doesn't do it for me, instead it creates the new

sheet file1 in
prog.xls and puts the chunk of data there.

How do I correctly refer to the workbook file.xls and put

the data in that
book instead of the prog.xls book?

Thanks for any help.

Regards,
Milos.




.