T
Tom Esker
I recorded a macro using Word 2002 that inserts letterhead into the
header of a new document based on a separate template file. It works
great except that the font of the text in the header changes to
whatever font was used in the document. How can I make the font in
the letterhead text stay put and not affect the font of the rest of
the text in the document? Below is the macro:
Sub NewLH2()
'
'' Macro recorded 05/19/2004 by tje
'
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or
ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ChangeFileOpenDirectory "F:\DATA\Workgroup Templates\"
Documents.Open FileName:="""D&B continous letterhead.dot""", _
ConfirmConversions:=False, ReadOnly:=False,
AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:=
_
wdOpenFormatAuto
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or
ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.WholeStory
Selection.Copy
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Copy
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Windows(2).Activate
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeBackspace
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
Thanks
Tom Esker
header of a new document based on a separate template file. It works
great except that the font of the text in the header changes to
whatever font was used in the document. How can I make the font in
the letterhead text stay put and not affect the font of the rest of
the text in the document? Below is the macro:
Sub NewLH2()
'
'' Macro recorded 05/19/2004 by tje
'
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or
ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ChangeFileOpenDirectory "F:\DATA\Workgroup Templates\"
Documents.Open FileName:="""D&B continous letterhead.dot""", _
ConfirmConversions:=False, ReadOnly:=False,
AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:=
_
wdOpenFormatAuto
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or
ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.WholeStory
Selection.Copy
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Copy
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Windows(2).Activate
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeBackspace
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
Thanks
Tom Esker