Public Function HexBin(strHexadecimal As String) As String
Dim strQout As String
Dim strTmp As String
Dim strTemp As String
Dim i As Integer
Dim j As Integer
intl = Len(strHexadecimal)
For i = intl To 1 Step -1
strQout = Mid(strHexadecimal, i, 1)
Select Case strQout
Case "A"
strQout = 10
Case "B"
strQout = 11
Case "C"
strQout = 12
Case "D"
strQout = 13
Case "E"
strQout = 14
Case "F"
strQout = 15
End Select
Do Until strQout = -1
If (strQout Mod 2) = 0 Then
strTmp = 0 & strTmp
Else
strTmp = 1 & strTmp
End If
strQout = Int(strQout / 2)
If strQout = 0 Then
strTemp = strTmp & strTemp
For j = 1 To 4 - Len(strTmp) Step 1
strTemp = 0 & strTemp
Next
strTmp = ""
strQout = -1
End If
Loop
Next
HexBin = Val(strTemp)
End Function