View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Macro Runs if Template name is .....

When you're in the VBE, you can hit ctrl-R to see the project explorer.

Find you your project and select it.
hit the asterisk on the numeric keypad to expand all the levels.

You'll see a ThisWorkbook item under the "microsoft excel objects".

That's where your code could go.

Alternatively, you could put your macro in a General module and name it
Auto_open.

Then each time the template opens (and each time a workbook based on that
template) opens, your code will run.

Nigel Downing wrote:

How can I automatically run a VBA macro based on the name of the template
the workbook was made from?
ie my template name is "bracing.xlt"
and I want all documents based on this to auto run a macro on opening.
(The macro will be used to load certain toolbars which are relevant to only
these workbooks.
I can run it manually but I want to automate it)

Thanks in advance


--

Dave Peterson