font changes in letterhead macro

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Tom Esker (tjesker_at_yahoo.com)
Date: 05/19/04


Date: 19 May 2004 11:54:10 -0700

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



Relevant Pages

  • Re: default template vs. normal template Word 2004
    ... Then you can put a toolbar icon for that macro up, ... then mad changes as to Font, Marginss and whether I ... had a header or footer. ... I prefer to use a Font called Beguiat. ...
    (microsoft.public.mac.office.word)
  • Re: Can Someone Help me fix this macro?
    ... ' Act on the Header in the next Section ... > I have created a macro in word that> inserts a new section break on a new page, opens the header on the new page, unlinks the new page header from the previous, selects and deletes the image in the header, and then replaces it with one specific to the macro. ... > Sub Header_EconomicDevelopment ... > ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader ...
    (microsoft.public.word.vba.general)
  • Re: VB runtime error 5941 Help
    ... I have created a macro that puts my name and the date in the header when i ... push the assigned keys Ctrl + D. However when i run the macro this is what ... ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader ...
    (microsoft.public.word.docmanagement)
  • create macro?
    ... I created a macro by going into the header then setting tabs & entering the ... ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader ... Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter ...
    (microsoft.public.word.vba.general)
  • Can Someone Help me fix this macro?
    ... inserts a new section break on a new page, opens the header on the new page, unlinks the new page header from the previous, selects and deletes the image in the header, and then replaces it with one specific to the macro. ... Sub Header_EconomicDevelopment ... ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader ...
    (microsoft.public.word.vba.general)