ChrW 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.


Синтаксис:


ChrW(charcode As Integer) As String

Повертає значення:

Рядок

Параметри:

charcode: Numeric expression that represent a valid 16 bit Unicode value (0-65535). (To support expressions with a nominally negative argument like ChrW(&H8000) in a backwards-compatible way, values in the range −32768 to −1 are internally mapped to the range 32768 to 65535.) An empty value returns error code 5. A value out of the range [0 to 65535] returns error code 6.

Коди помилок:

5 Неправильний виклик процедури

6 Переповнення

Приклад:


Sub ExampleChrW
    ' У цьому прикладі в рядок вставляються грецькі літери альфа і омега.
    MsgBox "From " + ChrW(913) + " to " + ChrW(937)
    ' У діалоговому вікні це буде виглядати як: Від Α до Ω
    MsgBox ChrW(charcode := 116) ' "t" lowercase T letter
End Sub

Будь ласка, підтримайте нас!