No, it's not possible.
In PC Word, you can use XML documents which do have the ability. But Mac
Word does not yet support XML, so sorry: you will have to use a macro.
If I rummage around here there's a macro that replaces the headers and
footers in a document.... Ummm.... Here you go...
The salient features are:
1. The macro first updates some styles that are used in the Headers and
footers from the attached template.
2. The macro then visits each section and ensures the page setup has not
been fiddled with. Note that it¹s calling the dimensions from Constants.
For each customer I have a long list of constants defined in a separate
procedure, so all the things I have to update for the customer are all in
one place.
3. The macro then loops through all of the sections in the document and
replaces each of the three headers and footers (this document is laid up for
double-sided printing). The source headers and footers are defined in their
entirety as AutoTexts in the template so they are easy to change.
4. In this particular publication, the header was entirely a vector graphic.
The call to FormatHeader was simply setting the graphic to the correct exact
size. (This particular document was a bugger to set up because the headers
over-hang the document margins. Poor practice, but one of those ³lesser of
two evils² calls...)
5. The Header Version at the end creates or sets a persistent document
variable to the version number of the template so we can tell instantly
whether this particular document has the current headers and footers.
6. This macro was written for Word 2000: some bits may not compile on the
Mac: just remove them or code-around them. Be careful of line-wraps when
receiving this over the Internet.
Here¹s the code...
Sub ReplaceHeadersFooters()
'
' Macro to put headers and footers right
' Macro written 27 Aug 2004 by John McGhie
'
Dim aVar As Variable
Dim bHeaderDone As Boolean
Dim bStylesDone As Boolean
Dim HeaderVersion As Integer
Dim aSection As Section
Dim aHeader As HeaderFooter
Dim aFooter As HeaderFooter
Dim aStyle As Style
Dim bTrackChanges As Boolean
bTrackChanges = ActiveDocument.TrackRevisions
If ActiveDocument.Type <> wdTypeTemplate Then
Application.OrganizerCopy _
Source:=ActiveDocument.AttachedTemplate.FullName, _
Destination:=ActiveDocument.FullName, _
Name:="Header", _
Object:=wdOrganizerObjectStyles
Application.OrganizerCopy _
Source:=ActiveDocument.AttachedTemplate.FullName, _
Destination:=ActiveDocument.FullName, _
Name:="HeaderLeft", _
Object:=wdOrganizerObjectStyles
Application.OrganizerCopy _
Source:=ActiveDocument.AttachedTemplate.FullName, _
Destination:=ActiveDocument.FullName, _
Name:="FooterRight", _
Object:=wdOrganizerObjectStyles
Application.OrganizerCopy _
Source:=ActiveDocument.AttachedTemplate.FullName, _
Destination:=ActiveDocument.FullName, _
Name:="FooterLeft", _
Object:=wdOrganizerObjectStyles
End If
For Each aSection In ActiveDocument.Sections
With aSection.PageSetup
.SectionStart = wdSectionOddPage
.DifferentFirstPageHeaderFooter = False
.OddAndEvenPagesHeaderFooter = True
.MirrorMargins = True
.Gutter = 0
.TopMargin = InsidePageMargin
.BottomMargin = BottomMargin
.LeftMargin = InsidePageMargin
.RightMargin = OutsidePageMargin
End With
With aSection.Headers(wdHeaderFooterPrimary)
.Range.Delete
ActiveDocument.AttachedTemplate.AutoTextEntries("TenderHeader").Insert
_
Where:=.Range, RichText:=True
.Range.Style = "Header"
Call FormatHeader(.Range)
End With
With aSection.Headers(wdHeaderFooterEvenPages)
.Range.Delete
ActiveDocument.AttachedTemplate.AutoTextEntries("TenderHeader").Insert
_
Where:=.Range, RichText:=True
.Range.Style = "HeaderLeft"
Call FormatHeader(.Range)
End With
With aSection.Footers(wdHeaderFooterPrimary)
.Range.Delete
.Range.Style = "FooterRight"
ActiveDocument.AttachedTemplate.AutoTextEntries("TenderFooterRight").Insert
_
Where:=.Range, RichText:=True
End With
With aSection.Footers(wdHeaderFooterEvenPages)
.Range.Delete
.Range.Style = "FooterLeft"
ActiveDocument.AttachedTemplate.AutoTextEntries("TenderFooterLeft").Insert _
Where:=.Range, RichText:=True
End With
Next ' asection
For Each aVar In ActiveDocument.Variables
If aVar.Name = "HeaderVersion" Then bHeaderDone = True
Next ' aVar
With ActiveDocument.Variables
If bHeaderDone Then
.Item("HeaderVersion").Value = intCurrHeader
Else
.Add Name:="HeaderVersion", Value:=intCurrHeader
End If
End With
With ActiveDocument
.TrackRevisions = bTrackChanges
.ShowRevisions = True
End With
End Sub
Sub FormatHeader(aHeader As Range)
' sets format of picture in header
' macro written 27 Aug 2004 by John McGhie
With aHeader.InlineShapes(1)
.Fill.Visible = msoFalse
.Fill.Transparency = 0#
.Line.Weight = 0#
.Line.Transparency = 0#
.Line.Visible = msoFalse
.LockAspectRatio = msoTrue
.Width = 453.5433
.PictureFormat.Brightness = 0.5
.PictureFormat.Contrast = 0.5
.PictureFormat.ColorType = msoPictureAutomatic
.PictureFormat.CropLeft = 0#
.PictureFormat.CropRight = 0#
.PictureFormat.CropTop = 0#
.PictureFormat.CropBottom = 0#
End With
End Sub
At my work I create multi-page documents that need to evolve thru
different template attributes during its creation. I'm looking for a
way to apply different template attributes to a document rather than
cut-and-paste the text into different templates.
Here is my situation;
A document is first created using the "Normal" template. The text will
then need to be printed using a template that has a "DRAFT" watermark.
After more changes are made the text finally goes to a template that
has the company letterhead, printed and sent to the client.
I've been working on this problem for a while but I have not found an
obvious solution. Is this even possible? Thanks for any help you can
give!
--
Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.
John McGhie <
[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 4 1209 1410