I am able to find and replace in word, however all I want to know is if the word was found, I have tried the following code:
This works

     oDoc.Content.Find.Execute(FindText:=x, ReplaceWith:=y, Replace:=Word.WdReplace.wdReplaceAll)

This never give the true statement

                     oDoc.Content.Find.Text = x
                        If oDoc.Content.Find.Found = True Then

But why not?

Recommended Answers

All 2 Replies

try to do it with selection instead of content. Make sure you start with selection.collapse if you don't want the search to be within the selected area only.

there isn't a selection option

oDoc is a word.document

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.