• Change fonts in styles (2000 SP1)

    Author
    Topic
    #367687

    I remember reading a post here (before Christmas) on a macro that could be used to to change the font of a particular style. I think it was used to change a style that had a hidden text property to be blue or something like that.

    Try as I might, I can’t find it.

    What I would like to do is to change the font for all of the headings (and several other styles in the document) without having to go in and do it by hand.

    Thanks for any help you can give me.

    Viewing 0 reply threads
    Author
    Replies
    • #574772

      Hi Melissa,

      In this case, the macro recorder will give you pretty good code. Just start the recorder, edit any style a bit, then stop the recorder and look at the macro. You can delete all lines that you don’t need.

      It’s common practice to base styles on each other, so that we don’t have to edit a lot of styles to change a font in the whole document.

      If you want to generally replace one font with another in a document or template, then something like this should work:

      Sub XChangeFont()
       Dim myStyle As Style
       For Each myStyle In ActiveDocument.Styles
        ' this prevents unused/buit-in styles from being changed:
        If myStyle.InUse = True Then
         If myStyle.Font.Name = "Times New Roman" Then
          myStyle.Font.Name = "Arial"
         End If
        End If
       Next myStyle
      End Sub

      cheersKlaus

    Viewing 0 reply threads
    Reply To: Change fonts in styles (2000 SP1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: