Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


Sets the string comparison method to sort equivalent text characters as equal.

The Option Compare statement must appear in a source file before any other statements. It affects string comparison for all code generated by that source file.

When to Use Text

If your strings contain all text characters, you often want to compare them, taking into account alphabetic equivalences such as case insensitivity and closely related letters. For example, you might want to consider A and a to be equal, and Ä and ä to come before B and b. To specify a text comparison, set Option Compare to Text.

The Text keyword can be used in this context:

Option Compare Statement

Community Additions

© 2015 Microsoft