Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Jun 2002
    Location
    PA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finding Special Characters (Word97 and up)

    In the good old days when the ASCII Table was simple and straight forward, I could reliably find
    characters using the timeword method of entering ^0<character code>. Since Unicode came along
    I have been unable to figure out how to use Word to search for characters above 127. I can record a
    macro to insert the character and read the character code. But it doesn't translate in reverse. The
    character recorded in the macro doesn't work in the find box. Word help is particularly vague
    on the matter, indicating that for characters over 127, the code depends on the character set
    used by your operating platform and blah blah blah. Seems obvious to me that, if you can insert
    the character from the Insert special character window, there should be some way for you
    to find it....or maybe I'm expecting too much. This was so simple in Word 6.......
    - Thanks for any ideas

  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: Finding Special Characters (Word97 and up)

    Hi Eric,

    The easiest way (without worrying about codes) is to copy the character to the clipboard and insert it (Ctrl+V) into "Find what".


    As far as codes are concerned, things are easier in principle as they used to be, because Word uses Unicode, and that's the same in all language versions.
    The help text ("the code depends on the character set used by your operating platform and blah blah blah") doesn't apply any more. On the other hand, the old Windows codes ^0XXX still work (and depend on your system). Even the old DOS codes ^XXX do work.

    But there are a lot more characters in a font now than there used to be: most fonts contain about 1300 characters, compared to about 200 in old fonts/code pages ... too much for a handy code table.

    And the ways to get the code or enter a character by code have only improved slowly over the versions 97/2000/2002.

    In Word2000, you can search for a character if you know its decimal Unicode number with ^uXXXX, and you can type it in any dialog with Alt+XXXX (not quite sure about Word97).

    For the character

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Finding Special Characters (Word97 and up)

    You also can use this rather simplistic "what is this next character" macro. I assign Ctrl+Alt+Shift+U to it:

    Sub UniCharIs()
    MsgBox "Selected character is " & AscW(Selection.Text)
    End Sub

    As you may know, if the selection is just an insertion point, Selection.Text reads the character to the right. If the selection spans more than one character, the result is for the first character in the selection.

    I haven't tested recently, but I'm pretty sure it doesn't work with Symbol because that uses some completely different system.

  4. #4
    New Lounger
    Join Date
    Jun 2002
    Location
    PA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding Special Characters (Word97 and up)

    That's the kind of function I was hoping for, but this doesn't return the unicode character - just the ASCII.
    Thanks anyway.

  5. #5
    New Lounger
    Join Date
    Jun 2002
    Location
    PA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding Special Characters (Word97 and up)

    Thanks. I was unaware of the ^uXXX trick and the ChrW(&H192) macro syntax. By pasting the character into the Find window while recording a macro I was able to get the unicode character code from the macro text. Hex to Decimal conversion isn't a problem, it's getting the Unicode character code in the first place. It doesn't display on the status bar using the Word97 Insert special character window.
    Interestingly, In word97, I can paste the special character into the Find window and search for it. Although,
    after I close the find and redisplay it again, the character reverts back to its ASCII character value - try it.
    In Word2000, I can't paste the character into the find window if the character is above 127. All I get is its
    non unicode ascii equivilent. But I can, as Klaus pointed out, find the unicode character code on the status bar when the Insert Symbol window is displayed in Word2000.

    The good news is once you have the code, you can search for it using the ^u<code> mechanism in either version of Word.

    Thanks for all responses.

    Thanks for your help. This was great information.

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

    Re: Finding Special Characters (Word97 and up)

    Jefferson's macro works fine. Don't let the function name AscW fool you: It returns Unicode. To return the code from the old Windows code page, you'd use Asc.

    My own macro works in both directions: If you select an XML/HTML-type encoded character &#xnnnn; and start the macro, it'll change that into the corresponding character. If you select a single character and start the macro, it changes that into the encoded form &#xnnnn;

    They really forgot to document most of that stuff in Word2000's online help. The ^unnnn notation is mentioned in some Knowledge Base article, and the fact that you can use Alt+nnnn in dialog boxes with Unicode isn't documented at all, as far as I know.

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

    <pre>Sub ToggleUnicode()
    ' changes &#x####; to corresponding character
    ' and selected character to &#x####;
    '
    ' commented-out lines for decimal codes
    '
    Dim strOut
    '
    ' Check which direction to go:
    If Len(Selection.Text) = 1 Then
    ' Selection.Text = "&#" & AscW(Selection.Text) & ";"
    Selection.Text = "&#x" & Hex$(AscW(Selection.Text)) & ";"
    Else
    ' If Left$(Selection.Text, 2) = "&#" And Right$(Selection.Text, 1) = ";" Then
    If Left$(Selection.Text, 3) = "&#x" _
    And Right$(Selection.Text, 1) = ";" _
    And Len(Selection.Text) < 9 Then
    ' strOut = Mid$(Selection.Text, 3)
    strOut = Mid$(Selection.Text, 4)
    strOut = Left$(strOut, Len(strOut) - 1)
    ' strOut = ChrW(strOut)
    strOut = ChrW("&H" & strOut)
    Selection.Text = strOut
    Else
    MsgBox "Selection not valid"
    End If
    End If
    End Sub</pre>


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

    Re: Finding Special Characters (Word97 and up)

    Hi Jefferson,

    > I haven't tested recently, but I'm pretty sure it doesn't work with
    > Symbol because that uses some completely different system.

    Characters from so-called "decorative" fonts like "Symbol" are a special case.

    If you have typed them in directly, your macro should work fine and return the code ... all decorative fonts use codes between 61472 (U+F020) and 61695 (U+F0FF).

    Symbols from these fonts that have been inserted from the "Insert > Symbol" dialog are "protected" (so that you can't change the font), and your macro would return the code 40.

    For a work-around see these macros to protect/unprotect all symbols from decorative fonts.

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

  8. #8
    New Lounger
    Join Date
    Jun 2002
    Location
    PA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding Special Characters (Word97 and up)

    Symbol font was the cause of the problem I was seeing. Thanks.

Posting Permissions

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