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 "short" trip āĻšāĻŋāĻ¸ā§‡āĻŦā§‡ āĻ†āĻŦāĻŋāĻ°ā§āĻ­ā§‚āĻ¤ āĻšā§ŸāĨ¤
            MsgBox Chr(charcode := 64) ' "@" sign
        End Sub
    

Please support us!