AscW Function [VBA]

Returns the Unicode value of the first character in a string expression.

แžšแžผแž”โ€‹แžแŸ†แžŽแžถแž„โ€‹แž–แŸ’แžšแž˜แžถแž“

This function or constant is enabled with the statement Option VBASupport 1 placed before the executable program code in a module.


Syntax:

AscW (Text As String)

Return value:

Integer

Parameters:

Text: Any valid string expression. Only the first character in the string is relevant.

Use the AscW function to replace keys with Unicode values. If the AscW function encounters a blank string, LibreOffice Basic reports a run-time error. Returned values are between 0 and 65535.

Error codes:

5 แž€แžถแžšโ€‹แž แŸ…โ€‹แž”แŸ‚แž”แž”แž‘โ€‹แž˜แžทแž“โ€‹แžแŸ’แžšแžนแž˜แžแŸ’แžšแžผแžœ

Example:

Sub ExampleAscW

 Print AscW("A") ' returns 65

 Print AscW("ฮฉ") ' returns 937

 Print AscW("ฮ‘ฮธฮฎฮฝฮฑ") ' returns 913, since only the first character (Alpha) is taken into account

End Sub