Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: search replace .doc
wdReplaceAll = 2 wdReplaceNone = 0 wdReplaceOne = 1 file = StrCat(dirget(),"test.doc") if !FileExist(file) message("Error","File not found") exit endif oWORD = ObjectOpen("Word.Application") oDOCS = oWORD.Documents oDOC = oDOCS.Open(file) Content = oDOC.Content Find = Content.Find oldtext = "duh" newtext = "No Duh!" Find.Execute(:: FindText = oldtext, ReplaceWith = newtext, Replace = wdReplaceAll) oDOC.SaveAs( StrCat(dirget(),"revisedtest.doc") ) oDOC.Close() oWORD.Quit() ObjectClose(Find) ObjectClose(Content) ObjectClose(oDOC) ObjectClose(oDOCS) ObjectClose(oWORD) Message("Operation Complete","See the revisedtest.doc file for changes.") Exit
Article ID: W15663
File Created: 2003:05:13:11:29:24
Last Updated: 2003:05:13:11:29:24