试试这样行不行
Dim a As Double
a = 40567893482
msgbox MyHex(a)
private function MyHex(a as double)
dim strNum as string
strNum=""
do while a<>0
n=a mod 16
if a<10 then strnum=strnum & chr(a+asc("0")) else strnum=strnum & chr(a+asc("A"))
a=int(a/16)
loop
Private Sub Command2_Click()
Dim a As Double, X As String
a = 40567893482#
X = Hex(Int(a / 16 ^ 6)) & Right("000000" & Hex(a - Int(a / 16 ^ 6) * 16 ^ 6), 6)
MsgBox X
End Sub
Function Bin2Hex(InputData As String) As String
Dim I As Integer
Dim LenBin As Integer
Dim JOne As String
Dim NumBlocks As Integer
Dim FullBin As String
Dim HexOut As String
Dim TempBinBlock As String
Dim TempHex As String
LenBin = Len(InputData)
For I = 1 To LenBin
JOne = Mid(InputData, I, 1)
If JOne <> "0" And JOne <> "1" Then
MsgBox "NOT A BINARY NUMBER", vbCritical
Exit Function
End If
Next I
FullBin = InputData
If LenBin < 4 Then
If LenBin = 3 Then
FullBin = "0" + FullBin
ElseIf LenBin = 2 Then
FullBin = "00" + FullBin
ElseIf LenBin = 1 Then
FullBin = "000" + FullBin
ElseIf LenBin = 0 Then
MsgBox "Nothing Given..", vbCritical
Exit Function
End If
NumBlocks = 1
GoTo DoBlocks
End If
If LenBin = 4 Then
NumBlocks = 1
GoTo DoBlocks
End If
If LenBin > 4 Then
Dim TempHold As Currency
Dim TempDiv As Currency
Dim AfterDot As Integer
Dim Pos As Integer