AscW Function [VBA]

返回某个字符串表达式中第一个字符对应的 Unicode 值。

warning

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


语法:


AscW (string) As Long

返回值:

Long

参数:

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

使用 AscW 函数替换包含有 Unicode 的键值。AscW 函数如果遇到空字符串,则 LibreOffice 会报告运行时错误。返回的值介于 0 和 65535 之间。

错误代码:

5 无效的过程调用

示例:


Sub ExampleAscW
 Print AscW("A") ' 返回 65
 Print AscW(string:="Ω") ' returns 937
 Print AscW("Αθήνα") ' 返回 913, 因为只考虑第一个字符
End Sub

请支持我们!