Function CleanStr(stInp As String, stSrch As String, stRepl As String) As String
'This function will search through a string and replace
'the specified text with a specified replacement.
On Error GoTo ErrorHandler
Dim Result As String
Result = stInp
If InStr(stInp, stSrch) > 0 Then
Result = Replace(stInp, stSrch, stRepl)
End If
CleanStr = Result
ExitProcedure:
Exit Function
ErrorHandler:
MsgBox "Unable to clean string.", vbExclamation, "String Error!"
Call AddErrorEvent(Err.Number, Err.Description, "CleanStr()")
Exit Function
End Function