Code:Dim n As Long
Dim tempArray() As Byte
ReDim tempArray(Len(StringData))
For n = 1 To Len(StringData)
tempArray(n - 1) = Asc(Mid(StringData, n, 1))
Next n
Printable View
Code:Dim n As Long
Dim tempArray() As Byte
ReDim tempArray(Len(StringData))
For n = 1 To Len(StringData)
tempArray(n - 1) = Asc(Mid(StringData, n, 1))
Next n
If you want to convert string into byte array then there is a better way - just use StrConv() function:
Code:Option Explicit
Private Sub Command1_Click()
Dim StringData As String
Dim tempArray() As Byte
Dim i As Integer
StringData = "Hello World!"
tempArray = StrConv(StringData, vbFromUnicode)
'test
For i = 0 To UBound(tempArray)
Debug.Print Chr(tempArray(i))
Next i
End Sub
OK, thanks, RB, that's what I was looking for instead of the For loop.
Any time... :wave: