Attribute VB_Name = "Module1" Option Explicit Public Function Hex2Bin(ByVal HexText As String) As String Dim I As Integer Dim Temp As String Temp = "" For I = 1 To Len(HexText) If Mid(HexText, I, 1) = "F" Then Temp = Temp & "1111" ElseIf Mid(HexText, I, 1) = "E" Then Temp = Temp & "1110" ElseIf Mid(HexText, I, 1) = "D" Then Temp = Temp & "1101" ElseIf Mid(HexText, I, 1) = "C" Then Temp = Temp & "1100" ElseIf Mid(HexText, I, 1) = "B" Then Temp = Temp & "1011" ElseIf Mid(HexText, I, 1) = "A" Then Temp = Temp & "1010" ElseIf Mid(HexText, I, 1) = "9" Then Temp = Temp & "1001" ElseIf Mid(HexText, I, 1) = "8" Then Temp = Temp & "1000" ElseIf Mid(HexText, I, 1) = "7" Then Temp = Temp & "0111" ElseIf Mid(HexText, I, 1) = "6" Then Temp = Temp & "0110" ElseIf Mid(HexText, I, 1) = "5" Then Temp = Temp & "0101" ElseIf Mid(HexText, I, 1) = "4" Then Temp = Temp & "0100" ElseIf Mid(HexText, I, 1) = "3" Then Temp = Temp & "0011" ElseIf Mid(HexText, I, 1) = "2" Then Temp = Temp & "0010" ElseIf Mid(HexText, I, 1) = "1" Then Temp = Temp & "0001" ElseIf Mid(HexText, I, 1) = "0" Then Temp = Temp & "0000" ElseIf Not Mid(HexText, I, 1) = " " Then MsgBox ("this is not hex") Exit For End If Next I If Not Len(Temp) = 64 Then For I = 0 To 64 - Len(Temp) Temp = "0" & Temp Next End If Hex2Bin = Temp End Function