| Option Explicit
Private mCol As Collection
Public Sub SplitInto(sIn As String, Optional sDelim As String = ",")
Dim sPart As String
Dim iPos As Long
Dim iLoc As Long
iLoc = 0
iPos = 1
Do
iLoc = InStr(iPos, sIn, sDelim)
If iLoc > 0 Then
sPart = Mid(sIn, iPos, iLoc - iPos)
iPos = iLoc + Len(sDelim)
Else
sPart = Mid(sIn, iPos)
iPos = 0
End If
mCol.Add sPart
Loop Until iPos = 0
End Sub
Public Function Add(sValue As String) As String
mCol.Add sValue
Add = sValue
End Function
Public Property Get Item(nIndex As Long) As String
Item = mCol(nIndex)
End Property
Public Property Get Count() As Long
Count = mCol.Count
End Property
Public Sub Remove(nIndex As Long)
mCol.Remove nIndex
End Sub
Public Property Get NewEnum() As IUnknown 'Procedure ID is -4
Set NewEnum = mCol.[_NewEnum]
End Property
Private Sub Class_Initialize()
Set mCol = New Collection
End Sub
Private Sub Class_Terminate()
Set mCol = Nothing
End Sub
|