View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default macro problems with Workbooks.Add Template

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.



Philip wrote:

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


--

Dave Peterson