Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finding Symbols (Word 97/XP)

    I am stumped. I created a macro to find symbols and replace them with text. Some symbols are being found and some are not. Is there something wrong with my codes? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

    <pre>Sub ReplaceSymbols()
    Dim x1(1 To 5, 1 To 2) As String
    Dim i As Integer

    x1(1, 1) = ChrW(223)
    x1(1, 2) = "sz"
    x1(2, 1) = ChrW(196)
    x1(2, 1) = "AU"
    x1(3, 1) = ChrW(228)
    x1(3, 1) = "au"
    x1(4, 1) = ChrW(192)
    x1(4, 1) = "Ag"
    x1(5, 1) = ChrW(224)
    x1(5, 1) = "ag"
    For i = 1 To 5
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = x1(i, 1)
    .Replacement.Text = x1(i, 2)
    .Forward = True
    .Wrap = wdFindStop
    .MatchCase = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Next i
    End Sub
    </pre>


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

    Re: Finding Symbols (Word 97/XP)

    Your array indices are wrong (probably an oversight after copying and pasting)

    x1(1, 1) = Chr(223)
    x1(1, 2) = "sz"
    x1(2, 1) = Chr(196)
    x1(2, 2) = "AU"
    x1(3, 1) = Chr(228)
    x1(3, 2) = "au"
    x1(4, 1) = Chr(192)
    x1(4, 2) = "Ag"
    x1(5, 1) = Chr(224)
    x1(5, 2) = "ag"

  3. #3
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding Symbols (Word 97/XP)

    I am so embarrassed <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

    lmao

Posting Permissions

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