ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Template Functionality (https://www.excelbanter.com/excel-programming/328261-template-functionality.html)

Nigel

Template Functionality
 
Hi All
I have developed an application and saved this as a template file. A
separate loader programme opens this template and populates a number of
sheets in the template and saving the template as a 'normal' workbook with a
new name. This process in repeated 15 times for different datasets. My
question concerns how does a template (xlt) file differ from a normal wks
file?

In my template I have some macros required for the final application,
including a workbook open event. I was under the impression that the
template would not run its macros upon opening - it clearly does! - how do
I disable the macros in the template so that they only run when it is saved
as an wks workbook?

--
Cheers
Nigel





Vasant Nanavati

Template Functionality
 
With ThisWorkbook
If .Name = .FullName Then Exit Sub
End With

--

Vasant



"Nigel" wrote in message
...
Hi All
I have developed an application and saved this as a template file. A
separate loader programme opens this template and populates a number of
sheets in the template and saving the template as a 'normal' workbook with

a
new name. This process in repeated 15 times for different datasets. My
question concerns how does a template (xlt) file differ from a normal wks
file?

In my template I have some macros required for the final application,
including a workbook open event. I was under the impression that the
template would not run its macros upon opening - it clearly does! - how

do
I disable the macros in the template so that they only run when it is

saved
as an wks workbook?

--
Cheers
Nigel







Stevie_mac

Template Functionality
 

"Nigel" wrote in message ...
Hi All
I have developed an application and saved this as a template file. A
separate loader programme opens this template and populates a number of
sheets in the template and saving the template as a 'normal' workbook with a
new name. This process in repeated 15 times for different datasets. My
question concerns how does a template (xlt) file differ from a normal wks
file?

In my template I have some macros required for the final application,
including a workbook open event. I was under the impression that the
template would not run its macros upon opening - it clearly does! - how do
I disable the macros in the template so that they only run when it is saved
as an wks workbook?

--
Cheers
Nigel







Stevie_mac

Template Functionality
 
Oops on the 1st reply!

Private Sub Workbook_Open()
If Me.FileFormat = xlTemplate Then Exit Sub
'do other stuff
'do other stuff
'do other stuff
'do other stuff
'do other stuff
'do other stuff
End Sub

Regards - Steve


"Nigel" wrote in message ...
Hi All
I have developed an application and saved this as a template file. A
separate loader programme opens this template and populates a number of
sheets in the template and saving the template as a 'normal' workbook with a
new name. This process in repeated 15 times for different datasets. My
question concerns how does a template (xlt) file differ from a normal wks
file?

In my template I have some macros required for the final application,
including a workbook open event. I was under the impression that the
template would not run its macros upon opening - it clearly does! - how do
I disable the macros in the template so that they only run when it is saved
as an wks workbook?

--
Cheers
Nigel








All times are GMT +1. The time now is 05:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com