PDA

View Full Version : Returning collections....



adamdelves
12-09-2001, 07:49 AM
For some peculiure reason VB CCE does not include the split function. Therefore i have had to create a function which does a similar task:

text = Split(text, " ")


Private Function Split(ByVal text As String, ByVal deli As String) As Collection

Dim place
place = 0

Do
place = InStr(place + 1, text, deli)
Split.Add Left(text, place)

text = Right(text, Len(text) - place)

Loop Until place = 0

End Function

When the code is debuged the following error is rasied on the line "text = split(text , " " )"-

"Argument not optional"

I have worked out that it is the As Collection statement in the funciton that is causeing this but don't know why. Does anyone have any ideas?