How to open a word document and search for specfic text?

I know how this works in Word VBA, but I'm not sure how to do it in VB .Net. Are Word VBA macro keywords and synatx portable to VB .Net? Basically, I have 20 to 30 page word document that I want to search for specfic text that a user would supply on a form using a text box and commandbutton.
LVL 2
Richard KreidlSoftware DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tusharashahCommented:
Check out this Article related to Search for Text in Word Document on MSDN:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrtskhowtosearchfortextinworddocuments.asp

-tushar
0
Richard KreidlSoftware DeveloperAuthor Commented:
I saw that article, isn't that for VB 6.0? And don't you have to open and read a word document before you can search it?
0
armoghanCommented:
You need to add the Com reference of MS Word
see the following article for it
http://www.c-sharpcorner.com/Code/2002/Mar/WordFromDotNet.asp

and then when you have the Active Document Object you can search it even without displaying it.

The link mentioned by tusharashah will work for VB.NET as well. see other related links at the bottom
also see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrtchconvertingcodeexamplesfromofficevbahelptovisualbasicnetc.asp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
iboutchkineCommented:
This will find and replace  a string


Dim bFound As Boolean

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "s"
        .Replacement.Text = "b"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
   bFound = Selection.Find.Execute(, , , , , , , , , , 2)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.