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