Hi
This is an easy one, and I think I will be embarased when (if) I get the answer.
I've got a string of 3 fields, delimited by colons. How do I get the posibion of these colons so I can extract the fields with a MID ?
Thanks
Robert
Printable View
Hi
This is an easy one, and I think I will be embarased when (if) I get the answer.
I've got a string of 3 fields, delimited by colons. How do I get the posibion of these colons so I can extract the fields with a MID ?
Thanks
Robert
Why dont you just use a Split() statement and split the words into an array?
Dim yArray
sentence = one:two:three
yArray = Split(sentence,":")
yArray(0)= one
yArray(1)= two
yArray(2)= three
A more generalized solution would be
VB Code:
Dim strParts() As String Dim lngIndex As Long strParts = Split(YOUR_STRING, ":") For lngIndex = 0 To UBound(strParts) Debug.Print strParts(lngIndex) Next
I just wrote the yarray(0) etc to show what the array would be filled like. thats good code MartinLiss. I might have to change how I loopp through my arrays, lol.
Thanks guys.
After I posted my question, I remembered the Instr. I didn't know about Split. But I do now.
Thanks
Robert
If your question is answered, make your thread as resolved.
And you can do that by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button.