Hex 函数

返回一个表示数字的十六进制值的字符串。

语法:


Hex (Number)

返回值:

字符串

参数:

数字」:要转换成十六进制数的任意数字表达式。

错误代码:

5 无效的过程调用

示例:


Sub ExampleHex
' uses BasicFormulas in Collabora Office 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-bit signed integer number from an 8-digit hexadecimal value.
    Hex2Lng = clng( sHex )
End Function
 
Function Lng2Hex(iLong As Long) As String
' Calculates the 8-digit hexadecimal value out of a 32-bit signed integer number.
    Lng2Hex = "&H" & Hex( iLong )
End Function

请支持我们!