Get ANSI Integer Method
The Get ANSI Integer method returns an integer that corresponds to the ANSI code of the first character in the string that you specify. You can use the Get ANSI String method to modify an ANSI code to string characters. For more information, see Get ANSI String Method.
Format
Asc(string)
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
string |
A string expression that contains one or more characters. |
Example
The following example asks the user for a letter and returns the ANSI value for this letter:
Sub Button_Click
Dim userchar As String
Dim ascVal as Integer
userchar = "Z"
ascVal = Asc(userchar)
End Sub