OLE expect plz help.....
How to use the looping for find & replace method in OLE by using WinWord program? And the most important thing is I need all the data are display in table.
Thanks for helping!! :)
Printable View
OLE expect plz help.....
How to use the looping for find & replace method in OLE by using WinWord program? And the most important thing is I need all the data are display in table.
Thanks for helping!! :)
Try:
public Sub ReplaceAndCount(sFind as string)
Dim nCount as Long
While ThisDocument.Content.Find.Execute(FindText:=sFind, Forward:=true, replacewith:="@@@@", replace:=wdReplaceOne)
nCount = nCount + 1
Wend
ThisDocument.Content.Find.Execute FindText:="@@@@", Forward:=true, replacewith:=sFind, replace:=wdReplaceAll
Debug.print nCount & " found and replaced"
End Sub
hth,
Duncan