Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Kalgoorlie, Western Australia, Australia
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change fonts in styles (2000 SP1)

    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.

  2. #2
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change fonts in styles (2000 SP1)

    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:

    <pre>Sub XChangeFont()
    Dim myStyle As Style
    For Each myStyle In ActiveDocument.Styles
    <font color=blue> ' this prevents unused/buit-in styles from being changed:</font color=blue>
    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</pre>



    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>Klaus

Posting Permissions

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