XL98: "Type Mismatch" Comparing String Variable to Boolean (184174)
The information in this article applies to:
- Microsoft Excel 98 Macintosh Edition
This article was previously published under Q184174 SYMPTOMS
In Microsoft Excel 98 Macintosh Edition, when you run a macro that runs
successfully in an earlier version of Microsoft Excel, the following error
message may appear:
Run-time error '13':
Type Mismatch
CAUSE
This problem may occur when the macro compares a string variable to a
Boolean variable.
In Microsoft Excel 98, a variable that you define as a string type cannot
be compared to the Boolean values True or False without generating a run-
time error.
WORKAROUND
To work around this problem, define the variable that you want to compare
to a Boolean variable as Variant instead of String; a Variant variable can
be compared to a Boolean variable without generating an error. For example,
if the macro contains a line of code that is similar to the following
Dim S As String
replace it with the following line of code:
Dim S As Variant
STATUS
This behavior is by design of Microsoft Excel 98.
Modification Type: | Minor | Last Reviewed: | 10/10/2006 |
---|
Keywords: | kbbug kbconversion kbdtacode kbnofix kbProgramming KB184174 |
---|
|