Public Function hex2ascii(ByVal hextext As String) As String
For y = 1 To Len(hextext)
num = Mid(hextext, y, 2)
Value = Value & Chr(Val("&h" & num))
y = y + 1
Next y
hex2ascii = Value
End Function
Usage:
=hex2ascii("4C4C322E5431534F")
Output:
LL2.T1SO |
Public Function ascii2hex(EvalString As String) As String
Dim intStrLen As Integer
Dim intLoop As Integer
Dim strHex As String
EvalString = Trim(EvalString)
intStrLen = Len(EvalString)
For intLoop = 1 To intStrLen
strHex = strHex & Hex(Asc(Mid(EvalString, intLoop, 1)))
Next
ascii2hex = strHex
End Function
Dim intStrLen As Integer
Dim intLoop As Integer
Dim strHex As String
EvalString = Trim(EvalString)
intStrLen = Len(EvalString)
For intLoop = 1 To intStrLen
strHex = strHex & Hex(Asc(Mid(EvalString, intLoop, 1)))
Next
ascii2hex = strHex
End Function
Usage:
=hex2ascii("LL2.T1SO")
Output:
4C4C322E5431534F |
沒有留言:
張貼留言