0

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)

Edited by happygeek: moved

1
Contributor
0
Replies
14
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.