Method: Hex for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: Hex for VBS
Method: Hex for VBS
Specifies the hexadecimal display of a number. You can enter a hexadecimal number directly by inserting the characters &H in front of the hexadecimal number.
vHex = Object.Hex(number)
| Object | VBS Object with this method. You do not need to specify this object. |
| number | Variant Specifies any expression. If number is not an integer, the Hex method first rounds the number value. |
| vHex | Variant Receives a character string in hexadecimal notation. |
The following example returns the hexadecimal value of various numbers:
Call MsgBox(Hex(4)) ' Returns 4. Call MsgBox(Hex(31)) ' Returns 1F Call MsgBox(Hex(4711)) ' Returns 1267