CByte Function

Converts a string or a numeric expression to the Byte type.

Sintaksis:

Cbyte( expression As Variant) As Byte

Nilai balikan:

Byte

Parameter:

Expression: Any string or a numeric expression that can be evaluated to a number. Decimal values are rounded to the nearest tenth. Valid values range from 0 to 256.

Kode kesalahan:

5 Tidak sah dalam pemanggilan prosedur

6 Tumpang tindih

Contoh:

Sub CByte_example
    Print CByte( expression := "17"/2 + 7.44), CByte(EMPTY), CByte(PI)
    ' Above expressions are computed as 16, 0 and 3
End Sub

Mohon dukung kami!