I'm trying to create a program that allows the user to type multiple sentences and after he clicks the button the program will capatilize the first letter of each sentence. I have done this but the sentences must have a double space after the period to work. I want the program to work even if the user only uses a single space after the period. Here is the code I have so far.

Dim strString As String
Dim searchStrTxt As Integer
Dim strCmpare As String
Dim strRplc As String
Dim strModified As String
Dim strFirstChr As String

strString = TextBox1.Text

strModified = strString
strFirstChr = UCase(Mid$(strModified, 1, 1))
strModified = strFirstChr & Mid$(strModified, 2)


'Search for single-spaced punctuation
For searchStrTxt = 1 To Len(strString) - 1
'DoEvents
strCmpare = Mid$(strModified, searchStrTxt, 3)
If strCmpare = ". " Then
strRplc = Mid$(strString, searchStrTxt, 4)
strModified = Replace$(strModified, strRplc, UCase$(strRplc))
End If

If strCmpare = "? " Then
strRplc = Mid$(strString, searchStrTxt, 4)
strModified = Replace$(strModified, strRplc, UCase$(strRplc))
End If

If strCmpare = "! " Then
strRplc = Mid$(strString, searchStrTxt, 4)
strModified = Replace$(strModified, strRplc, UCase$(strRplc))
End If
Next searchStrTxt

'Assign new string
TextBox1.Text = strModified