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 Invalid procedure call

6 Overflow

note

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


Example:


        Sub ExampleChr
            REM āļ¸āˇ™āļ¸ āļ‹āļ¯āˇāˇ„āļģāļĢāļē āļ…āļąāˇ” āļŊāļšāˇ”āļĢāˇ” āˇ€āˇāļŊāļš āļ‹āļ¯āˇŠāļ°āļģāļĢ āļŊāļšāˇ”āļĢāˇ” āļ‡āļ­āˇ”āļŊāˇŠ āļšāļģāļēāˇ’ (ASCII āļ…āļœāļē 34).
            MsgBox "A " + Chr$(34) + "short" + Chr(34) + " trip."
            REM āļ¸āˇ”āļ¯āˇŠâ€āļģāļĢ āļ´āˇ’āļ§āļ´āļ­ āˇƒāļ‚āˇ€āˇāļ¯āļēāļš āļ¸āˇ™āļŊāˇ™āˇƒ āļ´āˇ™āļąāˇ™āļēāˇ’: A "āļšāˇ™āļ§āˇ’" āˇ€āˇ’āļąāˇāļ¯ āļ āˇāļģāˇ’āļšāˇāˇ€āļšāˇŠ.
            MsgBox Chr(charcode := 64) ' "@" sign
        End Sub
    

Please support us!