Microsoft Office Word Forum - WordBanter

Microsoft Office Word Forum - WordBanter (http://www.wordbanter.com/index.php)
-   New Users (http://www.wordbanter.com/forumdisplay.php?f=3)
-   -   Global/Master Template (http://www.wordbanter.com/showthread.php?t=33726)

[email protected] October 27th 05 01:44 PM

Global/Master Template
 
Hi all!

I've got 400 or so letter templates written in Word.

Every so often my office change the header, footers, font & macro of
all of these. It would be a mamoth task to do manually.
I wrote a macro which opened each one in turn but that takes a while to
run as well.

Is there anyway that we can set up a master/global template which each
of these will use and therefore i only have to change the relavent bits
in only one document and not 400+.

Also if it is possible how can i get all 400 to use this document.

Hope somone can help. I really dont want to do this manually!

Thanks in advance!


Charles Kenyon October 27th 05 03:34 PM

Global/Master Template
 
Yes. It is possible to have a main template and templates that take their
information from that one.

No. It will not be easy to change the 400 you already have. It really works
best when set up from inception.

A simple method is to put the items that are subject to change in a global
template as AutoText entries. Then in the subsidiary templates, have the
AutoText inserted using AutoText fields. I would recommend an AutoNew macro
in each template that:
1) Updates all the AutoText fields in the document including headers and
footers, and then
2) Unlinks or at least freezes those fields so that the document (not the
template) will not change to reflect future changes.

I do things a bit more round-about. I have several main templates, each of
which has a document variable which is the template name. An AutoNew macro
checks that variable.

For instance, with letterhead...
I have a basic letterhead template that has all my information on it. The
things I would be changing a
Header info
Footer info
Styles
The headers and footers in the basic template contain one or more bookmarked
pieces of information.
The basic template has a document variable "BaseName" which is the name of
the base template.
The base template is stored in the letters and templates folder of the
workgroup templates folder.

Subsidiary or dependent templates are created by opening the base template
and using SaveAs. They can be saved to any location. The document variable
is not changed in subsidiary templates.

When a new letter is created using any of the templates, an AutoNew macro
checks the document variable against the attached template name. If they are
not the same, it attaches the new document to the base template (updating
the styles) and updates the bookmarked areas; if they are the same it simply
opens.

The macros I use are below.
Sub AutoNew()
' First part operates only in template other than "Kenyon Legal
Letter.dot"
' Brings in Headers and styles from "Kenyon Legal Letter.dot"
' Revised 28 January 2004
'
' Designed to allow changes in main letterhead headers or styles to
' automatically propogate in forms created by using SaveAs
' from that template.
'
' The name of the Base Template ("Kenyon Legal Letter.dot") is stored
' as a document variable in that template. That variable's
' name is "BaseName." Templates created using the base template
' will also have the same variable.
'
' If the name of the base template is changed, you need to change
' the variable in not only the base template but in
' every template that is based on it or this procedure
' will generate an error.
'
Dim sTemplateName As String
sTemplateName = ActiveDocument.Variables("BaseName").Value
' If this is not the base template for the letterhead, attach base
template
If ActiveDocument.AttachedTemplate.Name sTemplateName Then
ReplaceHeaders (sTemplateName) ' calls private sub (below)
' Application.OrganizerCopy( ' (for future work to update letterhead
styles)
AttachBase (sTemplateName)
End If
' Second part
' All new letters - show UserForm
Dim myForm As frmAddress
Set myForm = New frmAddress
myForm.Show
Unload myForm
Set myForm = Nothing
End Sub

Function WorkGroupPath() As String
' Written by Charles Kenyon
' February 28, 2003
'
' Used by templates menus to set location of templates.
' Returns workgroup tempates path with "\" at the end.
'
' This is needed because if the folder is a network drive rather
' than a folder, it will have the "\" already. If it is a folder,
' it will not have the backslash. This function gives a string
' with the backslash in either case.
'
WorkGroupPath =
Application.Options.DefaultFilePath(wdWorkgroupTem platesPath)
If Right(WorkGroupPath, 1) "\" Then
WorkGroupPath = WorkGroupPath & "\"
End If
End Function

Private Sub AttachBase(sTemplateName As String)
' Procedure written by Charles Kyle Kenyon 8 Dec 2003
' Reattaches Base Letterhead Template for form letters - attaches styles
'
Dim sTemplatesPath As String
sTemplatesPath = WorkGroupPath & "Letters & Faxes\"
'
With ActiveDocument
.UpdateStylesOnOpen = True
.AttachedTemplate = sTemplatesPath & sTemplateName
.UpdateStylesOnOpen = False
.AttachedTemplate = sTemplatesPath & sTemplateName
End With
End Sub

Private Sub ReplaceHeaders(sTemplateName As String)
' Altered to delete ranges 28 March 2004
'
' Replaces Header and FirstPageHeader with contents from
' base template
' Replaces Footer and FirstPageFooter with contents from
' base template
' Assumes that bookmarks have been preserved in base and copies.
' Otherwise will generate error
' Required bookmarks are "Footer1," "Footer2," "Header1," and
"Header2"
'
Dim rRange As Range
Dim sFooter As String
Dim sHeader As String
Dim iCount As Integer
'
' For iCount = 1 To 1 ' Replace 1st page header/footer only
For iCount = 1 To 2 ' Replace both headers, letterhead & continuation
sFooter = "Footer" & iCount
sHeader = "Header" & iCount
Set rRange = ActiveDocument.Bookmarks(sHeader).Range
rRange.Delete
rRange.InsertFile FileName:=WorkGroupPath _
& "Letters & Faxes\" & sTemplateName, _
Range:=sHeader, _
ConfirmConversions:=False, Attachment:=False, Link:=False
Set rRange = ActiveDocument.Bookmarks(sFooter).Range
rRange.Delete
rRange.InsertFile FileName:=WorkGroupPath _
& "Letters & Faxes\" & sTemplateName, _
Range:=sFooter, _
ConfirmConversions:=False, Attachment:=False, Link:=False
Next iCount
End Sub

This procedure lets us have multiple base letterheads. (We have computers
that generate documents for more than one law firm being used by a shared
secretary.) When a change is made to the base letterhead, it will propogate
through any subsidiary letter forms. It may give you a starting point, but
you have a lot of work ahead of you.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

wrote in message
oups.com...
Hi all!

I've got 400 or so letter templates written in Word.

Every so often my office change the header, footers, font & macro of
all of these. It would be a mamoth task to do manually.
I wrote a macro which opened each one in turn but that takes a while to
run as well.

Is there anyway that we can set up a master/global template which each
of these will use and therefore i only have to change the relavent bits
in only one document and not 400+.

Also if it is possible how can i get all 400 to use this document.

Hope somone can help. I really dont want to do this manually!

Thanks in advance!





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

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
WordBanter.com