Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Burpengary, Queensland, Australia
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Fix Font Macro (Word 2000)

    I have a VBA Module which quick fixes the font in the whole of the document:-

    Selection.WholeStory
    Selection.Font.Name = "DINGreek-Regular"
    Selection.Font.Size = 10

    However, it does not fix the font in the header and footer.

    Is there a quick way of selecting all headers and footers and changing font in both, or do I have to run a loop to do this?

    Any help would be appreciated.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Fix Font Macro (Word 2000)

    You do need a loop, but if you prefer, you can use a Range object rather than having to select each one.

  3. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Fix Font Macro (Word 2000)

    Hi Trish,

    Here's a macro that loops through a document updating fields the the body, headers, footers and any other text objects. You should find it fairly easy to adapt to your needs.

    Cheers

    Sub RefreshFields()
    Dim oSection As Section
    Dim shp as Shape
    Dim oHeadFoot As HeaderFooter
    ActiveDocument.Fields.Update
    For Each oSection In ActiveDocument.Sections
    For Each oHeadFoot In oSection.Footers
    If Not oHeadFoot.LinkToPrevious Then oHeadFoot.Range.Fields.Update
    Next
    For Each oHeadFoot In oSection.Headers
    If Not oHeadFoot.LinkToPrevious Then oHeadFoot.Range.Fields.Update
    Next
    Next 'oSection
    For Each shp In doc.Shapes
    With shp.TextFrame
    If .HasText Then
    .TextRange.Fields.Update
    End If
    End With
    Next
    End Sub
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •