Click to See Complete Forum and Search --> : OLE help...


tanhweeching
December 29th, 1999, 12:15 AM
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!! :)

Clearcode
December 29th, 1999, 08:21 AM
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