Thanks megatron that was very useful. I also need code that convert hex to binary can anyone help?
Printable View
Thanks megatron that was very useful. I also need code that convert hex to binary can anyone help?
this is a bit easier to do, because you can just replace the characers in Hex with binary strings
Code:Private Sub HetToBinary(HexString As String) As String
Dim i As Integer
Dim RetVal As String
For i = 1 To Len(HexString) - 1
Select Case Mid$(HexString,i,1)
Case "0"
RetVal = RetVal & "0000"
Case "1"
RetVal = RetVal & "0001"
Case "2"
RetVal = RetVal & "0010"
Case "3"
RetVal = RetVal & "0011"
Case "4"
RetVal = RetVal & "0100"
Case "5"
RetVal = RetVal & "0101"
Case "6"
RetVal = RetVal & "0110"
Case "7"
RetVal = RetVal & "0111"
Case "8"
RetVal = RetVal & "1000"
Case "9"
RetVal = RetVal & "1001"
Case "A"
RetVal = RetVal & "1010"
Case "B"
RetVal = RetVal & "1011"
Case "C"
RetVal = RetVal & "1100"
Case "D"
RetVal = RetVal & "1101"
Case "E"
RetVal = RetVal & "1110"
Case "F"
RetVal = RetVal & "1111"
End Select
HexToBinary = RetVal
End Function
Check out Stevie-O's post on this thread. All bases are covered. No pun intended. ;)
http://forums.vb-world.net/showthrea...threadid=15507