Chr Function

αžαŸ’αžšαž‘αž”αŸ‹β€‹αžαž½αž’αž€αŸ’αžŸαžšβ€‹αžŠαŸ‚αž›β€‹αžαŸ’αžšαžΌαžœβ€‹αž‚αŸ’αž“αžΆβ€‹αž‘αŸ…β€‹αž“αžΉαž„β€‹αž€αžΌαžŠβ€‹αžαž½β€‹αž’αž€αŸ’αžŸαžšβ€‹αž‡αžΆαž€αŸ‹αž›αžΆαž€αŸ‹Β αŸ”

Syntax:

Chr(Expression As Integer)

Return value:

αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžš

Parameters:

Expression: 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), Expression is a numeric expression that represents a valid 8-bit ASCII value (0-255) only.


αž”αŸ’αžšαžΎβ€‹αž’αž“αž»αž‚αž˜αž“αŸ Chr$ αžŠαžΎαž˜αŸ’αž”αžΈβ€‹αž•αŸ’αž‰αžΎβ€‹αž›αŸ†αžŠαžΆαž”αŸ‹β€‹αžœαžαŸ’αžαž»β€‹αž”αž‰αŸ’αž‡αžΆβ€‹αž–αž·αžŸαŸαžŸβ€‹αž‘αŸ…β€‹αž˜αŸ‰αžΆαžŸαŸŠαžΈαž“β€‹αž”αŸ„αŸ‡αž–αž»αž˜αŸ’αž– αž¬β€‹αž‘αŸ…β€‹αž”αŸ’αžšαž—αž–β€‹αž”αž„αŸ’αž αžΆαž‰β€‹β€‹αž•αŸ’αžŸαŸαž„β€‹αž‘αŸ€αžΒ αŸ” αž’αŸ’αž“αž€β€‹αž€αŸβ€‹αž’αžΆαž…β€‹αž”αŸ’αžšαžΎβ€‹αžœαžΆβ€‹αžŠαžΎαž˜αŸ’αž”αžΈβ€‹αž”αž‰αŸ’αž…αžΌαž›β€‹αžŸαž‰αŸ’αž‰αžΆβ€‹αžŸαž˜αŸ’αžšαž„αŸ‹β€‹αž€αŸ’αž“αž»αž„β€‹αž€αž“αŸ’αžŸαŸ„αž˜β€‹αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžšβ€‹αž˜αž½αž™Β αŸ”

Error codes:

5 αž€αžΆαžšβ€‹αž αŸ…β€‹αž”αŸ‚αž”αž”αž‘β€‹αž˜αž·αž“β€‹αžαŸ’αžšαžΉαž˜αžαŸ’αžšαžΌαžœ

6 αž›αžΎαžŸβ€‹αž…αŸ†αžŽαž»αŸ‡, when VBA compatibility mode is enabled and expression 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 αžŸαž“αŸ’αž›αžΉαž€β€‹αž”αŸ„αŸ‡αž–αž»αž˜αŸ’αž–β€‹β€‹αž“αžΉαž„β€‹αž”αž„αŸ’αž αžΆαž‰β€‹αž€αŸ’αž“αž»αž„β€‹αž”αŸ’αžšαž’αž”αŸ‹β€‹αž‡αžΆ αŸ– A "short" tripΒ αŸ”
        End Sub
    

ASC

Please support us!