Word: Searching for Special Characters in a Macro
PSS ID Number: Q71151 Article last modified on 11-02-1994
5.00 5.50 6.00
MS-DOS
SUMMARY
You can check or search for special characters from a Word macro by putting the special character code within quotation marks. The following example can be used to determine if the selection is a paragraph mark:
<<IF selection = "^P">> {do some action} <<ENDIF>>
-or-
<<WHILE selection <> “^P”>> {do some action} <<ENDIF>>
A listing of the special character codes can be found in Chapter 10 of the “Using Microsoft Word” version 5.00 manual or Chapter 8 of the “Using Microsoft Word” version 5.50 manual.
The end-of-file (EOF) marker is recognized by Word as a null character, represented by "“. Use the reserved variable”selection" to check that the selected text is equal to "" (the endmark). The following are two examples:
<<IF selection = "">>…
<<WHILE selection <> "">>…
The first example carries out subsequent macro steps if “selection” is equal to the endmark; the second example carries out subsequent macro steps if “selection” is not equal to the endmark.
KBCategory: kbother kbmacro KBSubcategory: Additional reference words: ============================================================================= Copyright Microsoft Corporation 1994.