Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default macro problems with Workbooks.Add Template

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




  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default macro problems with Workbooks.Add Template

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

"Dave Peterson" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with shared workbooks Mia Excel Discussion (Misc queries) 1 May 9th 08 12:40 AM
Problems opening excel workbooks dull40 Excel Discussion (Misc queries) 1 November 6th 07 05:56 PM
linking problems and worksheets and workbooks Ironwig Excel Discussion (Misc queries) 0 April 19th 06 11:21 PM
Problems when printing large workbooks Jayne Excel Discussion (Misc queries) 0 March 8th 05 03:43 PM
Problems with referring to workbooks Matt Lawson Excel Programming 1 February 21st 04 04:26 PM


All times are GMT +1. The time now is 01:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"