Microsoft KB Archive/71151: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "<" to "<")
m (Text replacement - ">" to ">")
Line 11: Line 11:
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:
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">&gt; {do some action} <<ENDIF>&gt;
<<IF selection = "^P">> {do some action} <<ENDIF>>


-or-
-or-


<<WHILE selection <&gt; “^P”&gt;&gt; {do some action} <<ENDIF>&gt;
<<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.
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.
Line 21: Line 21:
The end-of-file (EOF) marker is recognized by Word as a null character, represented by &quot;“. Use the reserved variable”selection&quot; to check that the selected text is equal to &quot;&quot; (the endmark). The following are two examples:
The end-of-file (EOF) marker is recognized by Word as a null character, represented by &quot;“. Use the reserved variable”selection&quot; to check that the selected text is equal to &quot;&quot; (the endmark). The following are two examples:


<<IF selection = "">&gt;
<<IF selection = "">>


<<WHILE selection <&gt; &quot;&quot;&gt;&gt;
<<WHILE selection <> &quot;&quot;>>


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.
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.
KBCategory: kbother kbmacro KBSubcategory: Additional reference words: ============================================================================= Copyright Microsoft Corporation 1994.

Revision as of 10:50, 21 July 2020

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.