Function asc2hex(str As String) As String
Dim I As Long
For I = 1 To Len(str)
asc2hex = asc2hex & Hex(Asc(Mid(str, I, 1))) & " "
Next I
asc2hex = RTrim(asc2hex)
End Function
Function Asc2Hex(S As String) As String
Dim X As Long, B() As Byte, H() As String
B = S
ReDim H(LBound(B) To UBound(B))
For X = LBound(B) To UBound(B)
If X Mod 2 Then
H(X) = " "
Else
H(X) = Hex(B(X))
End If
Next
Asc2Hex = Trim(Join(H, ""))
End Function