Function b2h(bstr)
'convert binary string to hex string
cnvarr = Array("0000", "0001", "0010", "0011", _
"0100", "0101", "0110", "0111", "1000", _
"1001", "1010", "1011", "1100", "1101", _
"1110", "1111")
'find number of HEX digits
a = Len(bstr)
ndgt = a / 4
If (a Mod 4 > 0) Then
MsgBox ("must be integer multiple of 4Bits")
Exit Function
End If
hstr = ""
For i = 1 To ndgt
dgt = Mid(bstr, (i * 4) - 3, 4)
For k = 0 To 15
If (dgt = cnvarr(k)) Then
ix = k
End If
Next
hstr = hstr & Hex(ix)
Next
b2h = hstr
End Function