I have an arrayList created as:
Dim coll As Object
Set coll = CreateObject("System.Collections.ArrayList")
coll.Add "240,70,90,45,62,255,255"
coll.Add "255,70,90,23,54,56,123"
...
...
and a function that accepts an array to work with individual elements such as (240,70,90,45,62,255,255), not "255,70,90,23,54,56,123". How can I convert my "string of elements" into individual elements? Keep in mind I need the array to be of type Variant. I can't use a string. I had to create an arrayList initially because I could not create a massive array such as
buf = Array(198, 132, 36, 170, 0, 0, 0, 102, 198, 132, 36..............)
I need to pass an array of type Variant in order to be able to use it in this function below:
Sub WriteBinary(FileName, buf)
Dim I, aBuf, Size, bStream
Size = UBound(buf): ReDim aBuf(Size \ 2)
For I = 0 To Size - 1 Step 2
aBuf(I \ 2) = ChrW(buf(I + 1) * 256 + buf(I))
Next
If I = Size Then aBuf(I \ 2) = ChrW(buf(I))
aBuf = Join(aBuf, "")
Set bStream = CreateObject("ADODB.Stream")
bStream.Type = 1: bStream.Open
With CreateObject("ADODB.Stream")
.Type = 2: .Open: .WriteText aBuf
.Position = 2: .CopyTo bStream: .Close
End With
bStream.SaveToFile FileName, 2: bStream.Close
Set bStream = Nothing
End Sub