Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Custom Replace procedure (2002 SP-2)

    A friend who sends plain text instead of HTML e-mail uses the ~ character instead of italics. For example, "Woody's Lounge is ~great!~"

    In saving these e-mails as Word documents, I manually replace the ~great!~ with great! -- which is tedious and time-consuming.

    Does anyone know how I can use Word's Replace function (Ctrl + H) to automate this procedure?

    Thanks!

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Custom Replace procedure (2002 SP-2)

    Try Edit > Replace (or Control-H)

    Click the more button and select "Use wildcards"

    Find what = ~(*)~
    Replace with = 1
    whilst the cursor is in the replace with box click Format > Font > Italic
    Click Replace All

    StuartR

  3. #3
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Re: Custom Replace procedure (2002 SP-2)

    Hi Stu,

    Thanks so much; that did it!

    Just one last thing. I tried to Record the below steps as a macro, but no matter how many times I tried, the Format > Font > Italic part never worked. Here's the macro I recorded; do you know what and where I need to add for Format > Font > Italic?

    Thanks again!

    Sub Italicize_Tildes()
    '
    ' Italicize_Tildes Macro
    ' Macro recorded 10/19/2003 by Jonathan Rick
    '
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    End With
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    End With
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = "~(*)~"
    .Replacement.Text = "1"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    End Sub

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Custom Replace procedure (2002 SP-2)

    Jonathan,

    I removed the duplication that resulted from recording the macro and added .Replacement.Font.Italic = True within the With Selection.Find ... End With block:

    Sub Italicize_Tildes()

    ' Italicize_Tildes Macro
    ' Macro recorded 10/19/2003 by Jonathan Rick
    ' Adapted 10/19/2003 by HansV

    With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .MatchWildcards = True
    .Text = "~(*)~"
    .Replacement.Text = "1"
    .Replacement.Font.Italic = True
    .Forward = True
    .Execute Replace:=wdReplaceAll
    End With
    End Sub

  5. #5
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Re: Custom Replace procedure (2002 SP-2)

    Perfect; thanks Hans!

Posting Permissions

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