Function removeExtraSpaces(ByVal strString As String) As String
Dim strResult As String Dim intIndex As Integer Dim spaceCount As Integer strResult = "" spaceCount = 0 For intIndex = 1 To Len(strString) If (Mid$(strString, intIndex, 1) = " ") Then spaceCount = spaceCount + 1 ElseIf (Mid$(strString, intIndex, 1) <> " ") Then spaceCount = 0 End If If spaceCount < 2 Then strResult = strResult + Mid$(strString, intIndex, 1) End If Next intIndex removeExtraSpaces = strResult End Function |