Chr Function

Grąžina simbolį, kuris atitinka nurodytą simbolio kodą.

Sintaksė:


      Chr[$](charcode As Integer) As String
    

Grąžinimo reikšmė:

String

Parametrai:

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.


Norėdami siųsti specialias valdymo sekas į spausdintuvą ar kitą išvesties šaltinį, naudokite funkciją Chr$. Taip pat eilutės reiškinyje galite naudoti kabutes.

Klaidos kodai:

5 Neteisingas procedūros iškvietimas

6 Perpildymas

note

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


Pavyzdys:


        Sub ExampleChr
            ' Šis pavyzdys įterpia kabutes (ASCII reikšmė 34) eilutėje.
            MsgBox "A " + Chr$(34) + "short" + Chr(34) + " trip."
            ' Spausdinamas rezultatas pasirodo dialoge: „Trumpa“ kelionė.
            MsgBox Chr(charcode := 64) ' "@" sign
        End Sub
    

Paremkite mus!