D
Dorthe
Hi everyone
I have about 10 templates that use the same toolbar, autotexts, styles and
VBA code. Until now I have stored the toolbar, autotexts etc. In each
template.
It wasn't very interesting, when an autotext had to be modified. Then it had
to be modified in each template. This due to the fact that the company I work
for doesn't want a global template for us all.
Now however, I came of the thought that I could just load a template via an
auto new and auto open macro.
Here is my code that I have placed in each of my templates:
Private Sub Document_New()
With ActiveDocument
.UpdateStylesOnOpen = True
End With
AddIns.Add FileName:= _
"C:\Documents and Settings\DB\Skrivebord\Key template.dot",
Install:=True
With ActiveDocument
.UpdateStylesOnOpen = True
End With
End Sub
Private Sub Document_Open()
With ActiveDocument
.UpdateStylesOnOpen = True
End With
AddIns.Add FileName:= _
"C:\Documents and Settings\DB\Skrivebord\Key template.dot",
Install:=True
With ActiveDocument
.UpdateStylesOnOpen = True
End With
End Sub
It all works fine, but e.g. my toolbar shows up twice each time I start a
new document based on one of my templates. When I close the document, one
toolbar stays on. The functions just doesn't work of course.
I can see that the "Key Template.dot" that now holds all of my autotexts,
the one toolbar and my macros is still loaded, also when no documents are
open anymore.
Can anyone help with this - is it a simple line that needs to be added the
code?
I have about 10 templates that use the same toolbar, autotexts, styles and
VBA code. Until now I have stored the toolbar, autotexts etc. In each
template.
It wasn't very interesting, when an autotext had to be modified. Then it had
to be modified in each template. This due to the fact that the company I work
for doesn't want a global template for us all.
Now however, I came of the thought that I could just load a template via an
auto new and auto open macro.
Here is my code that I have placed in each of my templates:
Private Sub Document_New()
With ActiveDocument
.UpdateStylesOnOpen = True
End With
AddIns.Add FileName:= _
"C:\Documents and Settings\DB\Skrivebord\Key template.dot",
Install:=True
With ActiveDocument
.UpdateStylesOnOpen = True
End With
End Sub
Private Sub Document_Open()
With ActiveDocument
.UpdateStylesOnOpen = True
End With
AddIns.Add FileName:= _
"C:\Documents and Settings\DB\Skrivebord\Key template.dot",
Install:=True
With ActiveDocument
.UpdateStylesOnOpen = True
End With
End Sub
It all works fine, but e.g. my toolbar shows up twice each time I start a
new document based on one of my templates. When I close the document, one
toolbar stays on. The functions just doesn't work of course.
I can see that the "Key Template.dot" that now holds all of my autotexts,
the one toolbar and my macros is still loaded, also when no documents are
open anymore.
Can anyone help with this - is it a simple line that needs to be added the
code?