Function SepareMots(ByVal chaine As String, ByVal delim As String) As String() Dim tableau() As String Dim indice, i As Integer indice = 0 ReDim Preserve tableau(indice) For i = 0 To Len(chaine) If Mid(chaine, i + 1, 1) = delim Then indice = indice + 1 ReDim Preserve tableau(indice) Else tableau(indice) = tableau(indice) + Mid(chaine, i + 1, 1) End If Next i SepareMots = tableau End Function
Dim tableau() As String tableau = SepareMots("test1#test2#test3", "#")