Hello Freddy,
How convert a number for the string equivalent?
For example:
I have the number "16448", I would like take this number in a two bytes
strings, the number represent the "@@".
Do I understand you correctly that you want it as hex? Then you can use
the following function. Please check for line breaks:
Private Function NumberToHexStrings(ByVal ThisNumber As Long, ByVal
StringLength As Byte) As String()
Dim retVal() As String
If StringLength = 0 Then
ReDim retval(-1)
Else
Dim ArrSize As Integer, t As Integer
Dim tNumber As String = Hex(ThisNumber)
While tNumber.Length Mod StringLength <> 0
tNumber = "0" & tNumber
End While
ArrSize = Fix((CDec(tNumber.Length) / CDec(StringLength)) + 0.5) - 1
ReDim retVal(ArrSize)
t = ArrSize
While t > -1
retVal(t) = Strings.Right(tNumber, StringLength)
tNumber = Strings.Left(tNumber, tNumber.Length - StringLength)
t = t - 1
End While
End If
Return retVal
End Function
Use it like this:
Dim s() As String
s = NumberToHexStrings(16448, 2)
Best regards,
Martin