WD: How to Determine ASCII Value of Any Character

ID: Q27885

The information in this article applies to:

SUMMARY

Word for Windows 6.x, Word for the Macintosh 6.x

In Word, you can find the ASCII value of any single character by selecting the character and then running the following macro.

   Sub Main
      Rem The symbol must be selected before running the macro.
      AsciiVal$ = Str$(Asc(Selection$())
      MsgBox "The ASCII value is " + AsciiVal$
   End Sub

NOTE: You can use this macro in Word for Windows, versions 6.x or 7.x. However, if the character was inserted using the Symbol dialog box (Insert menu) the value returned is always incorrect. If the symbol was inserted using Character Map, the macro returns the correct ASCII value

Word for the Macintosh 5.x

In Word for the Macintosh, versions 5.0 and 5.1, the Symbol command is used for determining the ASCII value of a character. To use the Symbol command, do the following:

1. From the Insert menu, choose Symbol.

2. From the Font menu, choose the desired font and size.

3. Find the desired character in the table and click on the character

   once.

NOTE: If the Symbol command is installed, and COMMAND+OPTION+Q is pressed, a table of all available characters for that font are displayed. If the desired character is found, press the symbol to insert that character into the document. In the lower left hand corner of the symbol window will be the ASCII equivalent as well as the keystrokes needed to produce the character if the character is a printable character.

If the Symbol command is not installed, COMMAND+OPTION+Q will work as described below for Word versions 4.0 and 3.0x.

Word for the Macintosh 3.0, 4.0

In Microsoft Word for the Macintosh, versions 3.0 or 4.0, you can find the ASCII value of any single character by selecting the character and then pressing COMMAND+OPTION+Q. The ASCII value then appears in the lower-left corner of the window.

If you do not select any text, or if you select more than one character, the lower-left corner prompts you with "Code." You can then type in a specific ASCII value (integer) and press the RETURN key on the main keyboard or the ENTER key on the numeric keypad to insert the character with that value.

MORE INFORMATION

Once you use the "Paste Special Character" command by pressing COMMAND+OPTION+Q, you can repeat the action by clicking the lower-left corner. This is true of any special procedures that use the lower-left corner. Other special procedures include "Apply Style Name" (COMMAND+SHIFT+S), "Change Font" (COMMAND+SHIFT+E), "Insert Glossary Text" (COMMAND+BACKSPACE or DELETE).

Additional query words: forty

Keywords          : winword macword word7 word95 kbFont kbhowto 
Version           : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:3.0,3.01,3.02,4.0,5.0,5.10,6.0,6.0.1,6.0.1a
Platform          : MACINTOSH WINDOWS
Issue type        : kbhowto kbinfo

Last Reviewed: February 4, 1998