Hello, I uses this code(See below) to search a string for words and replace them, but when i want to search for a " and replace that, VB gets mad at me, and tells me that thats wrong.... any onw know how i can fix this?
Code:Public Function ReplaceAll(ByVal searchString As Variant, findString As Variant, replaceString As Variant) As String Dim strLeft As String Dim strRight As String Dim iFoundPos As Integer strRight = searchString If findString <> "" Then Do While InStr(strRight, findString) <> 0 iFoundPos = InStr(strRight, findString) strLeft = strLeft & Left(strRight, iFoundPos - 1) & replaceString strRight = Right(strRight, Len(strRight) - (iFoundPos - 1) - Len(findString)) Loop End If ReplaceAll = strLeft & strRight End Function




Reply With Quote