Private Function Byte2HexStr(bt() As Byte) As String
Dim btLen As Integer
Dim I As Integer
Dim strDes As String
btLen = UBound(bt) + 1
strDes = Space$(btLen * 2)
For I = 0 To btLen - 1
Mid$(strDes, I + I + 1, 2) = Right$( "0 " & Hex$(bt(I)), 2)
Next I
Byte2HexStr = strDes
End Function
Private Function HexStr2Byte(strSrc As String) As Byte()
Dim strLen As Integer
Dim btLen As Integer
Dim I As Integer
Dim bt() As Byte
strLen = Len(strSrc)
btLen = strLen / 2
ReDim bt(btLen - 1)
For I = 0 To btLen - 1
bt(I) = Val( "&H " & Mid$(strSrc, I + I + 1, 2))
Next I
HexStr2Byte = bt
End Function