CitectVBA Programming Reference > CitectVBA Function Reference > String Functions > Chr

Chr

Converts a number into its string character ASCII code value.

The Chr function expects the argument Num to be a valid numeric integer (whole positive number within the range 0 to 255 inclusive). If Chrcontains no number, a runtime error occurs.

Note: Values 8, 9, 10, and 13 convert to backspace, tab, linefeed, and carriage return characters respectively.

The Chr function performs the opposite of the Asc function, which converts a text string character to it's numeric ASCII code value.

Syntax

Chr(Num)

Num:

An integer or expression representing a valid numeric value.

Return Value

Returns a single character string representing the ASCII character code value of the number Num provided in the argument.

Related Functions

Asc

Example

Dim vntVar	 ' declare result holder variable
vntVar = Chr(65) ' returns "A"
vntVar = Chr(97) ' returns "a"
vntVar = Chr(90) ' returns "Z"
vntVar = Chr(122) ' returns "z"