Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
bigdaddy3
 
Posts: n/a
Default copy and paste using code from workbook to workbook

how do i copy and paste from a template new workbook with a name say reports
and then from that template is called another workbook which says reports1
and so on till say 10.The workbook i am trying to copy to will be open the
same time as the template new workbook report number either 1 to 10 whatever
i need.Using a macro if possible
--
BD3
  #2   Report Post  
TomHinkle
 
Posts: n/a
Default

Don't worry about the name of the workbook
use object variables..

dim wbSource as workbook
dim wbTarget as workbook

set wbSource = workbooks.open("myWorkbook.xls")

Set wbTarget = workbooks.add("myTemplate.xlt")

you can then put a loop around creating new workbooks, etc.

the Open method will open a specific workbook
Add will open a new workbook based on the template you supply (but a
different file)

Sooo, try those out.





"bigdaddy3" wrote:

how do i copy and paste from a template new workbook with a name say reports
and then from that template is called another workbook which says reports1
and so on till say 10.The workbook i am trying to copy to will be open the
same time as the template new workbook report number either 1 to 10 whatever
i need.Using a macro if possible
--
BD3

  #3   Report Post  
bigdaddy3
 
Posts: n/a
Default

Hi Tom
sorry i dont quite understand a--where would you put the code and b i might
not have explained properly the name of the workbooks i will be copying from
will have all different names but the one i want to copy to will be an
invoice workbook taken from an invoice template so the code would have to be
on the original invoice template and to be able to cope with any name
automatically does that make more sense
--
BD3


"TomHinkle" wrote:

Don't worry about the name of the workbook
use object variables..

dim wbSource as workbook
dim wbTarget as workbook

set wbSource = workbooks.open("myWorkbook.xls")

Set wbTarget = workbooks.add("myTemplate.xlt")

you can then put a loop around creating new workbooks, etc.

the Open method will open a specific workbook
Add will open a new workbook based on the template you supply (but a
different file)

Sooo, try those out.





"bigdaddy3" wrote:

how do i copy and paste from a template new workbook with a name say reports
and then from that template is called another workbook which says reports1
and so on till say 10.The workbook i am trying to copy to will be open the
same time as the template new workbook report number either 1 to 10 whatever
i need.Using a macro if possible
--
BD3

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
paste formulas between workbooks without workbook link ron Excel Discussion (Misc queries) 3 April 22nd 23 08:11 AM
Copy and paste from 1 workbook to another bigdaddy3 Excel Worksheet Functions 0 September 13th 05 10:05 AM
I cannot paste from one workbook to another. Copy works, paste do. JimmyMc Excel Discussion (Misc queries) 1 June 10th 05 03:54 PM
Can't Copy and Paste between Excel 2003 Workbooks wllee Excel Discussion (Misc queries) 6 March 30th 05 02:59 PM


All times are GMT +1. The time now is 03:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"