String zu Hex:
Public Function Str2Hex(text As String, Optional separator As String = "") _
As String
Dim val As String
Do While Len(text) > 0
val = Hex(Asc(Left(text, 1)))
val = IIf(Len(val) = 1, "0" & val, val)
Str2Hex = Str2Hex & val & separator
text = Mid(text, 2)
Loop
If Len(Str2Hex) > 0 Then Str2Hex = Left(Str2Hex, Len(Str2Hex) - Len(separator))
End Function
Hex zu String:
Public Function Hex2Str(ByVal HexString As String)
Dim i As Long, TempString As String, Temp2 As String
On Local Error Resume Next
For i = 1 To Len(HexString) Step 2
TempString = TempString & Chr$(val("&H" & Mid$(HexString, i, 2)))
Next i
Hex2Str = TempString
End Function