Visual Basic for Applications Reference

Chr Function

See Also Example Specifics

Returns a String containing the character associated with the specified character code.



The required charcodeargument is a Long that identifies a character.


Numbers from 0 31 are the same as standard, nonprintable ASCIIcodes. For example, Chr(10) returns a linefeed character. The normal range for charcode is 0 255. However, on DBCSsystems, the actual range for charcode is -32768 to 65535.

*Note* The ChrB function is used with byte data contained in a String. Instead of returning a character, which may be one or two bytes, ChrB always returns a single byte. The ChrW function returns a String containing the Unicode character except on platforms where Unicode is not supported, in which case, the behavior is identical to the Chr function.