WD: Lowercase a, b, and c Do Not Compare Correctly in WordBasicLast reviewed: February 2, 1998Article ID: Q94855 |
The information in this article applies to:
SYMPTOMSThe logical string operation example on page 35 of "Using WordBasic", which compares the values of "c" and "D", does not yield the correct result.
MORE INFORMATIONAccording to "Using WordBasic," the evaluation of (n = "c" > "D") produces a "TRUE" (non-zero) result because "c" occurs after "D" in the ANSI code set. When you perform this operation in a WordBasic macro, the macro incorrectly reports a "FALSE" (zero) result. The incorrect result also occurs if you replace "c" with the lowercase letters "a" or "b". In contrast, the lowercase letters "d" through "z" yield correct results. In addition, if you compare the lowercase letters "a", "b" and "c" to their uppercase counterparts (A, B, and C), the macro yields a correct result of "TRUE" (non-zero).
WORKAROUNDUse the ASC macro command to return the ANSI code for the text strings to be compared. The following macro produces correct comparison results:
n = ASC("c") > ASC("D") print nWhen you run the macro, the correct value (TRUE) appears on the status bar.
Steps to Reproduce ProblemThe following macro incorrectly reports a "FALSE" (zero) result instead of the correct result of "-1" (TRUE):
Sub Main n = "c" > "D" print n End SubIn addition, if you change the logical operator from ">" to "<", as shown in the example below, the macro also yields incorrect results ("-1" or "TRUE").
n = "c" < "D" STATUSMicrosoft has confirmed this to be a problem in the versions of Microsoft Word listed above. This problem was corrected in Word 97 for Windows and Word 98 Macintosh Edition.
REFERENCES"Using WordBasic," by WexTech Systems and Microsoft, page 35
|
Additional query words: winword2
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |