Avoid Split() Coding: Use Splits Class to Avoid Tedious Split() Function Coding.
The Split() function is something that has to be used over and over again. The split function allows you to break up a string into pieces which is returned as an array. The coding involved is repetitive and tedious. Here is a class you can create which will save you lots of time in the future which I call the [cSplit] class.
This class has one routine called [Go]. This routine handles the Split() coding and returns each element of the returned array in the event [Event SplitReturn(sItem As String)].
Enter all of the following code in a class module and save it for future use.
Event Error(sMod As String, sNum As String, sDesc As String)
Event SplitReturn(sItem As String)
Sub Go(sStringToSplit as string, sDelimiter as string)
On Error GoTo err:
Dim sParts() As String: sParts = Split(sStringToSplit, sDelimiter, , vbTextCompare)
Dim iUpp As Integer: iUpp = UBound(sParts)
Dim i As Integer
For i = 0 To iUpp
Exit Sub 'function
If .Number <> 0 Then
RaiseEvent Error("Go", err.Number, err.Description)