Does this do it?Code:Private Function ExtendedSplit(ByVal strInputString As String) As String() Dim i As Integer Dim objRegExp Dim objMatch Dim colMatches Dim strTestInput As String Dim strOldValue As String Dim strNewValue As String Dim tempArr() As String ' Create a regular expression object. Set objRegExp = CreateObject("VBScript.RegExp") 'Set the pattern. objRegExp.Pattern = "\"".*?\""" 'Set global applicability. objRegExp.Global = True 'Test whether the String can be compared. If (objRegExp.Test(strInputString) = True) Then 'Get the matches. Set colMatches = objRegExp.Execute(strInputString) Debug.Print strInputString ' Iterate Matches collection. For Each objMatch In colMatches strOldValue = objMatch.Value strNewValue = Replace(strOldValue, Chr(34), Chr(128)) strNewValue = Replace(strNewValue, Chr(32), Chr(129)) 'Debug.Print objMatch.Value strInputString = Replace(strInputString, strOldValue, strNewValue) Next Debug.Print strInputString End If For i = 1 To 127 Select Case i Case 1 To 47, 59 To 64, 91 To 96, 123 To 127 strInputString = Replace(strInputString, Chr(i), " " & Chr(i) & " ") End Select Next i Do While InStr(strInputString, Space(2)) strInputString = Replace(strInputString, Space(2), Space(1)) Loop strInputString = Trim(strInputString) tempArr = Split(strInputString, " ") For i = 0 To UBound(tempArr) tempArr(i) = Replace(tempArr(i), Chr(128), Chr(34)) tempArr(i) = Replace(tempArr(i), Chr(129), Chr(32)) Next i ExtendedSplit = tempArr End Function




Reply With Quote