Chr Function

지정한 문자 코드에 해당하는 문자를 표시합니다.

Syntax:

Chr[$](charcode As Integer) As String

Return value:

String

Parameters:

charcode: a numeric expression that represents a valid 8-bit ASCII value (0-255) or a 16-bit Unicode value. (To support expressions with a nominally negative argument like Chr(&H8000) in a backwards-compatible way, values in the range −32768 to −1 are internally mapped to the range 32768 to 65535.)

warning

When VBA compatibility mode is enabled (Option VBASupport 1), charcode is a numeric expression that represents a valid 8-bit ASCII value (0-255) only.


특수한 제어 시퀀스를 프린터나 다른 출력 원본으로 보내려면 Chr$ 함수를 사용합니다. 또한 이 함수를 사용하여 따옴표를 문자열 식에 삽입할 수 있습니다.

Error codes:

5 잘못된 프로시저 호출입니다.

6 오버플로우가 발생했습니다.

note

An overflow error will occur when VBA compatibility mode is enabled and the expression value is greater than 255.


Example:

Sub ExampleChr
    REM This example inserts quotation marks (ASCII value 34) in a string.
    MsgBox "A " + Chr$(34) + "short" + Chr(34) + " trip."
    REM The printout appears in the dialog as: A "short" trip.
    MsgBox Chr(charcode := 64) ' "@" sign
End Sub

Please support us!