The easiest method is to create a template workbook with the macro in
the template. Then make a copy of the template when you start your
macro.
If code is located on the VBA sheet (not module) if you copy the sheet
the code also gets copies. In VBa if you copy a sheet and do not use
Affter or Before it automatically creates a new workbook with only one
sheet.
Another method is to write a macro that saves the VBA code to a BAS
file and then read the BAS file into the 2nd workbook. Chip Pearson has
good instruction on doing this at his website
'Programming In The VBA Editor'
(
http://www.cpearson.com/excel/vbe.aspx)
Read the two bullets at the top of the webpage espcially the one
below.
•Next, you need to enable programmatic access to the VBA Project. In
Excel 2003 and earlier, go the Tools menu (in Excel, not in the VBA
editor), choose Macros and then the Security item. In that dialog, click
on the Trusted Publishers tab and check the Trust access to the Visual
Basic Project setting.
--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=175507
Microsoft Office Help