HI!
I'm trying to convert a formatted string to Hex. It seems to going well. I'm getting problem with the format 'vbNewLine' and 'vbCrLf' both represented inside the string with ''. Their Ascii values are '13' and '10'. I read that this character () is not supported by Microsoft Windows.
How can I solve that problem?
'---
' Here the code
'---
Public Function AsciitoHex(ByVal str As String)
Dim Buchstabe$, x%, AsciiVal As Byte
Const Hexa = 16
x = Hexa - Len(str) Mod Hexa
' Nothing happened here. why?
str = Replace(str, "", "", 1, -1, vbTextCompare)
If x <> Hexa Then str = str & Space(x)
For x = 1 To Len(str)
Buchstabe = Mid$(str, x, 1)
'here too
If Buchstabe = "" Then
Buchstabe = "vbcrlf"
End If
If Buchstabe = Chr$(0) Then
AsciiVal = 0
Else
AsciiVal = (Asc(Buchstabe))
End If
AsciitoHex = AsciitoHex & Hex(AsciiVal)
Next
End Function
thx for helping
james
I'm trying to convert a formatted string to Hex. It seems to going well. I'm getting problem with the format 'vbNewLine' and 'vbCrLf' both represented inside the string with ''. Their Ascii values are '13' and '10'. I read that this character () is not supported by Microsoft Windows.
How can I solve that problem?
'---
' Here the code
'---
Public Function AsciitoHex(ByVal str As String)
Dim Buchstabe$, x%, AsciiVal As Byte
Const Hexa = 16
x = Hexa - Len(str) Mod Hexa
' Nothing happened here. why?
str = Replace(str, "", "", 1, -1, vbTextCompare)
If x <> Hexa Then str = str & Space(x)
For x = 1 To Len(str)
Buchstabe = Mid$(str, x, 1)
'here too
If Buchstabe = "" Then
Buchstabe = "vbcrlf"
End If
If Buchstabe = Chr$(0) Then
AsciiVal = 0
Else
AsciiVal = (Asc(Buchstabe))
End If
AsciitoHex = AsciitoHex & Hex(AsciiVal)
Next
End Function
thx for helping
james