Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Nov 2003
    Posts
    61
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Replacing Italic and Bold Fonts w/ italic and bold attributes

    I'm working on getting italic fonts to be replaced by regular Word italic attributes in Word 2010/2013. I have this piece of code that works, but its so cumbersome that I think there must be a better way of doing it. And, once I add all of the fonts that I'll need to do that to, its going to look really ugly. I appreciate any ideas:

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Font.Italic = True
    Selection.Find.Replacement.Font.Name = "Times New Roman"
    With Selection.Find
    .Font.Name = "Times New Roman Italic"
    .Text = "^?"
    .Replacement.Text = "^&"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll



    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Font.Bold = True
    Selection.Find.Replacement.Font.Name = "Times New Roman"
    With Selection.Find
    .Font.Name = "Times New Roman Bold"
    .Text = "^?"
    .Replacement.Text = "^&"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll


    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Font.SmallCaps = True
    Selection.Find.Replacement.Font.Name = "Times New Roman"
    With Selection.Find
    .Font.Name = "Times New Roman SmallCap"
    .Text = "^?"
    .Replacement.Text = "^&"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll


    The other fonts I have to do this to are:

    Adobe Garamond Small Cap & Old
    Adobe Garamond Semibold Small C
    Garamond 3 Small Caps & Old Sty
    Goudy Catalogue SC T
    Goudy Handtooled SC D
    Minion Small Caps & Oldstye Fi
    Minion Semibold Small Caps Old
    MrsEaves SmallCaps
    TimesTen Roman SC
    NewBaskerville SC
    ACaslon Regular SC
    AGaramond RegularSC
    Bembo SC
    Times SC
    Adobe Jenson RegularSC
    Minon RegularSC
    OldStyle 7 SC
    GaramondThree-SC
    MrsEavesSmallCaps

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    This could be further modularised to have a sub which calls a function repeatedly but here is a simpler version of what you posted.
    Code:
    Sub temp2()
      With Selection.Find
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .text = ""
        .Replacement.text = ""
        .ClearFormatting
        
        'Repeatable unit
        .Replacement.ClearFormatting
        .Font.Name = "Times New Roman Italic"
        .Replacement.Font.Name = "Times New Roman"
        .Replacement.Font.Italic = True
        .Execute Replace:=wdReplaceAll
        
        .Replacement.ClearFormatting
        .Font.Name = "Times New Roman Bold"
        .Replacement.Font.Name = "Times New Roman"
        .Replacement.Font.Bold = True
        .Execute Replace:=wdReplaceAll
        
      End With
    End Sub
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

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