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!