'PROCESS: SPLIT USER'S INPUT STRING INTO SEPERATE SENTENCES 'Encode abbreviations such as Mr. Mrs. and Ms. InputString = Replace(InputString, "MR.", "Mr", 1, -1, vbTextCompare) InputString = Replace(InputString, "MRS.", "Mrs", 1, -1, vbTextCompare) InputString = Replace(InputString, "MS.", "Ms", 1, -1, vbTextCompare) InputString = Replace(InputString, "DR.", "Dr", 1, -1, vbTextCompare) InputString = Replace(InputString, "MS.", "Ms", 1, -1, vbTextCompare) InputString = Replace(InputString, "ST.", "St", 1, -1, vbTextCompare) InputString = Replace(InputString, "PROF.", "Prof", 1, -1, vbTextCompare) InputString = Replace(InputString, "GEN.", "Gen", 1, -1, vbTextCompare) InputString = Replace(InputString, "REP.", "Rep", 1, -1, vbTextCompare) InputString = Replace(InputString, "SEN.", "Sen", 1, -1, vbTextCompare) 'This is the new section which can be removed at any time to go back to original InputString = Replace(InputString, " A. ", " A ", 1, -1, vbTextCompare) InputString = Replace(InputString, " B. ", " B ", 1, -1, vbTextCompare) InputString = Replace(InputString, " C. ", " C ", 1, -1, vbTextCompare) InputString = Replace(InputString, " D. ", " D ", 1, -1, vbTextCompare) InputString = Replace(InputString, " E. ", " E ", 1, -1, vbTextCompare) InputString = Replace(InputString, " F. ", " F ", 1, -1, vbTextCompare) InputString = Replace(InputString, " G. ", " G ", 1, -1, vbTextCompare) InputString = Replace(InputString, " H. ", " H ", 1, -1, vbTextCompare) InputString = Replace(InputString, " I. ", " I ", 1, -1, vbTextCompare) InputString = Replace(InputString, " J. ", " J ", 1, -1, vbTextCompare) InputString = Replace(InputString, " K. ", " K ", 1, -1, vbTextCompare) InputString = Replace(InputString, " L. ", " L ", 1, -1, vbTextCompare) InputString = Replace(InputString, " M. ", " M ", 1, -1, vbTextCompare) InputString = Replace(InputString, " N. ", " N ", 1, -1, vbTextCompare) InputString = Replace(InputString, " O. ", " O ", 1, -1, vbTextCompare) InputString = Replace(InputString, " P. ", " P ", 1, -1, vbTextCompare) InputString = Replace(InputString, " Q. ", " Q ", 1, -1, vbTextCompare) InputString = Replace(InputString, " R. ", " R ", 1, -1, vbTextCompare) InputString = Replace(InputString, " S. ", " S ", 1, -1, vbTextCompare) InputString = Replace(InputString, " T. ", " T ", 1, -1, vbTextCompare) InputString = Replace(InputString, " U. ", " U ", 1, -1, vbTextCompare) InputString = Replace(InputString, " V. ", " V ", 1, -1, vbTextCompare) InputString = Replace(InputString, " W. ", " W ", 1, -1, vbTextCompare) InputString = Replace(InputString, " X. ", " X ", 1, -1, vbTextCompare) InputString = Replace(InputString, " Y. ", " Y ", 1, -1, vbTextCompare) InputString = Replace(InputString, " Z. ", " Z ", 1, -1, vbTextCompare) InputString = Replace(InputString, "SR.", "Mr", 1, -1, vbTextCompare) InputString = Replace(InputString, "MR.", "Mr", 1, -1, vbTextCompare) InputString = Replace(InputString, "JR.", "Jr", 1, -1, vbTextCompare) InputString = Replace(InputString, "INC.", "Inc", 1, -1, vbTextCompare) 'End of new section 'Remove unnecessary punctuation Do RepeatLoop = False If InStr(InputString, "..") Then InputString = Replace(InputString, "..", "."): RepeatLoop = True If InStr(InputString, "??") Then InputString = Replace(InputString, "??", "?"): RepeatLoop = True If InStr(InputString, "!!") Then InputString = Replace(InputString, "!!", "!"): RepeatLoop = True If InStr(InputString, "!?") Then InputString = Replace(InputString, "!?", "?"): RepeatLoop = True If InStr(InputString, "?!") Then InputString = Replace(InputString, "?!", "?"): RepeatLoop = True If InStr(InputString, ",,") Then InputString = Replace(InputString, ",,", ","): RepeatLoop = True Loop While RepeatLoop = True 'Detect and encode acronyms such as U.S.A. InputString = Trim(InputString) WordList = Split(InputString, " ") For i = 0 To UBound(WordList) If Len(WordList(i)) > 3 Then If Right(WordList(i), 1) = "." And Mid(WordList(i), Len(WordList(i)) - 2, 1) = "." Then InputString = Replace(InputString, WordList(i), Left(WordList(i), Len(WordList(i)) - 1) & "") End If End If Next 'Place split markers in string InputString = Replace(InputString, ". ", ". ") InputString = Replace(InputString, "? ", "? ") InputString = Replace(InputString, "! ", "! ") 'Decode acronyms and abbreviations InputString = Replace(InputString, "", ".", 1, -1, vbTextCompare) 'Split string into sentences Sentences = Split(InputString, "")