macro problems with Workbooks.Add Template

P

Philip

If I create a new XL workbook based on a template then the new workbook
contains all the macros that are in the template.

However:
If one of these macros creates a new workbook based on the same template
(i.e. using Workbooks.Add Template:=TemplateLocation) then the resulting
workbook does not contain the template macros.

If I haven't explained this properly then please shout and I'll post more
info.
Any help would be much appreciated.

Thanks

Philip
 
D

Dave Peterson

I couldn't duplicate your findings.

I created a workbook with some code in it. I saved that workbook as a template
(and closed it).

Then in another workbook, I put this code:

Option Explicit
Sub testme()
Dim newWkbk As Workbook
Set newWkbk = Workbooks.Add(template:="c:\my documents\excel\book1.xlt")
End Sub

The new workbook had the code.
 
P

Philip

Thanks Dave for your comprehensive reply - I must have been having a senior
moment - it works for me too.

Thanks again and sorry to trouble you w/ something so stupid

Cheers

Philip
 

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