CitectVBA Programming Reference > CitectVBA Function Reference > String Functions > Asc

Asc

Converts a text string character to its numeric ASCII code value. The Asc function expects the argument Str to be a valid string expression. If Strcontains no characters, a runtime error occurs. The Asc function performs the opposite of the Chr function, which converts a number into its string character ASCII code value.

Syntax

Asc(Str)

Str:

A string or expression that can represent a valid text value.

Return Value

Returns the numeric ASCII code value of the first character in Str provided in the argument.

Related Functions

Chr

Example

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