Search - Replace

N

nntp

I have some code that I am trying to do a search and replace on a Rich Text
file.

Dim WordDoc As Object
Set WordDoc = CreateObject("Word.Application")
WordDoc.Documents.Open ("test.rtf")
WordDoc.Application.Visible = True
With WordDoc.Selection.Find
.Text = "AAA"
.Replacement.Text = "BBB"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
WordDoc.Selection.Find.Execute Replace:=wdReplaceAll

MSWord opens and highlights the first instance of the the search but doesn't
replace.

I am using Access 2000 and MSWord 2000.

Any help would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top