Create a template?

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
 
R

Richard Choate

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
 
E

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
 
D

Dave Peterson

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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top