Function sSplit(ByVal expression As String, find As String) As Variant
Dim i As Variant, j As Integer, k As Integer
Dim result() As Variant
j = 1
i = InStr(j, expression, find)
If i = 0 Then
ReDim result(0)
result(0) = expression
sSplit = result
Exit Function
End If
While i <> 0
ReDim Preserve result(0 To k + 1)
result(k) = Mid(expression, j, i - j)
k = k + 1
j = i + Len(find)
i = InStr(j, expression, find)
Wend
If k > 0 Then 'le dernier
ReDim Preserve result(0 To k)
result(k) = Mid(expression, j, Len(expression) - (j - Len(find)))
End If
sSplit = result
End Function
|