How to do replace strings in Vbscript
Visual Basic
1
Posts
1
Posters
0
Views
1
Watching
-
Hi I am using the following code to replace a string in VbScript. Documents.Closeall Documents.Open FileName.txt, "Text" ActiveDocument.Selection.StartOfDocument blnFound = ActiveDocument.Selection.FindText(String) If blnFound = true Then ActiveDocument.ReplaceText String "ReplaceStr 2.2" MsgBox "Hello World!", 65, "MsgBox Example" End If ActiveDocument.Save FileName.txt My filename.txt looks like this: string 2.3,002 4 The script replaces "String" with "ReplaceStr 2.2", but I also want to replace all the part following string i.e 2.3,002 4. I want my filename to look like this after the script is run: ReplaceStr 2.2 instead of ReplaceStr 2.2 2.3,002 4 Any help will be very much apprciated. Thanks