View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.newusers
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default why use templates?

Templates are very handy for creating new workbooks with the formatting and
layout desired but if Template has workbook_open code you don't want it
running when you re-open the workbook after it has been saved.

To prevent code running when you re-open a saved workbook created from a
Template, check for a path.

A saved workbook will have a path.

An unsaved workbook will not.

Check for the path and Exit Sub if path is found.

If not, carry on with workbook_open code.

Private Sub Workbook_Open()

If ActiveWorkbook.Path < "" Then Exit Sub

'your code here

End Sub


Gord Dibben MS Excel MVP

On Thu, 31 Dec 2009 07:45:01 -0800, Arne
wrote:

No, I am not a student. I ran into a little problem using an ordinary
read-only workbook as a template (it appears that I cannot open one for
editing using the Workbooks.Open method without activating the VBA code that
is attached to it, but that method has a parameter 'Editable' which according
to the help function works for templates, but using a template instead of a
workbook seems to make no difference), so I wondered if I missed some
important point about templates.

Thanks for the answer.

Regards,

Arne
"Harald Staff" wrote:

"Arne" wrote in message
...
Meaning?


" What are the specific advantages of xxx in terms of" is not often an excel
problem to be solved, but a pretty common kind of question a teacher asks
his students, and which the student passes unmodified to us. So I guess Don
took you for a student. Maybe you are <g.

A template can be added to the templates gallery, that's the only difference
I can think of. I never use templates, writeonly workbooks works better for
my porposes.

Best wishes Harald

.