Get ANSI String Method
The Get ANSI String method returns the character string that corresponds to the ANSI code of the character that the charCode argument contains.
Format
Chr[$](charCode)
For information about the dollar sign, see Usage of the Dollar Sign.
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
charCode |
An integer in the rage of 0 through 255 that identifies the ANSI code for a character. |
Example
The following example displays the character equivalent for an ASCII code in the range of 65 through 122:
Sub Button_Click
Dim numb as Integer
Dim msgtext as String
Dim out as Integer
out = 0
Do Until out
numb = 75
If Chr$(numb)> = "A" AND Chr$(numb)< = "Z" _
OR Chr$(numb)> = "a" AND Chr$(numb)< = "z" then
msgtext = "The letter for the number " & numb _
" is: " & Chr$(numb)
out = 1
ElseIf numb = 0 then
Exit Sub=
Else
msgtext = "Does not convert to a character; try again."
End If
Loop
End Sub