mercredi 25 février 2015

Random string split into characters

I have a procedure, that generates a random string without any delimiter. I store return value of this as a string, but I would like to split this text into characters and after that examine each characters. I try to use above code to split string into characters, but it gives Type mismatch error.



Sub gen()
Dim s As String
s = textgen(4000, 5)
Dim buff() As String
ReDim buff(Len(s) - 1)

For i = 1 To Len(s)
buff(i - 1) = Mid$(s, i, 1)
Next

MsgBox (buff) ' type mismatch
End Sub




Aucun commentaire:

Enregistrer un commentaire