Create a template?

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

I'm working on a macro that will go with a single workbook. I think I
understand that I need to insert a new module in ThisWorkbook and place my
code there. (Did I get that right?)

The next question is: I update this workbook two or three times a week,
creating a new workbook with the new information with each update. Can I
create a template for use with my update that will contain this code? Or do
I need to manually transfer this module to each new workbook?

Ed
 
You don't need to insert a new module in "This Workbook", Just insert a
module into the VBA project associated with your Excel file. Once you have
this code in the file, any time you save as a new file name, your code will
follow. As an alternative, if you want your macro to be available to you in
any Excel file, you can put your new module in your Personal.XLS workbook.
Let us know if that is your interest and you need help.

Richard Choate

I'm working on a macro that will go with a single workbook. I think I
understand that I need to insert a new module in ThisWorkbook and place my
code there. (Did I get that right?)

The next question is: I update this workbook two or three times a week,
creating a new workbook with the new information with each update. Can I
create a template for use with my update that will contain this code? Or do
I need to manually transfer this module to each new workbook?

Ed
 
Thank you. It'll be a little bit before I get all the bugs out and I try
it. If I blow something up, I'll be sure to holler!

Ed
 
I agree with Richard if you're updating this workbook manually. But if you have
another macro that creates this workbook, I like the idea of that other macro
using a template file.

You could preformat the worksheets the way you want them (page
layout/shading/etc). You could protect the VBA code. Then you wouldn't have to
do that each time you create that workbook from scratch. (Protecting the VBA
project mechanically is not an easy thing to do right. The only way I've seen
to do it involves Sendkeys, and that's not very reliable.)
 
Back
Top