Hex Function
傳回一個表示數字的十六進制值的字串。
語法:
Hex (Number)
傳回值類型:
字串型
參數:
Number:要轉換為十六進制數的任意數值型表示式。
示例:
Sub ExampleHex
' uses BasicFormulas in LibreOffice Calc
Dim a2, b2, c2 As String
a2 = "&H3E8"
b2 = Hex2Lng(a2)
MsgBox b2
c2 = Lng2Hex(b2)
MsgBox c2
End Sub
Function Hex2Lng(sHex As String) As Long
' Returns a 32 bits signed integer number from an 8 digits hexadecimal value.
Hex2Lng = clng( sHex )
End Function
Function Lng2Hex(iLong As Long) As String
' Calculates the 8 digits hexadecimal value out of a 32 bits signed integer number.
Lng2Hex = "&H" & Hex( iLong )
End Function