WORD Find and replace
Keywords: WORD Find and replace
Here is VB code that will do a find and replace -- someone might want to convert it to Winbatch. Probably the only problem you will have is with the Execute method as it uses positional parameters.For reference, see the list of OLE constants in the DB.
Option Explicit Sub ExecuteReplace() ' This procedure demonstrates using the Execute ' method to replace text. ' Open the file. Documents.Open FileName:="c:\odept1dc.doc" Documents("odept1dc.doc").Activate ' Loop until no more items are found. Do Selection.Find.ClearFormatting With Selection.Find .Text = "display" .Execute ReplaceWith:="show", _ Replace:=wdReplaceAll, Forward:=True End With ' Exit the loop when the search is unsuccessful. If Selection.Find.Execute = False Then Exit Do Loop End Sub