samuel_23 0 Newbie Poster

hello,
i dont know much about programming, but i want to find a certain piece of text in a document that was opened using microsoft visual basic 2010 express. below is my code to open the word doc and to find and replace the text but is faulty

'to open the doc
Dim objWord As Word.Application
            objWord = New Word.Application
            objWord.Visible = True
            objWord.Documents.Open("C:Address for doc", , , True)
            'must change the address of the document if on other device

 'to find and replace text within doc
 objWord.Content.Find.execute(FindText:="Address", _
            ReplaceWith:=Label1.Text, _
            Replace:=Word.WdReplace.wdReplaceAll)
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.