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 このサンプルは、引用符 (ASCII 値 34) を文字列中に挿入します。
            MsgBox "A "+ Chr$(34)+"short" + Chr$(34)+" trip."
            REM ダイアログには A "short" trip. と表示されます。
        End Sub
    

ASC

ご支援をお願いします!