CByte Function Example

This example uses the CByte function to convert an expression to a Byte.

Dim MyDouble, MyByte
MyDouble = 125.5678   ' MyDouble is a Double.
MyByte = CByte(MyDouble)   ' MyByte contains 126.