Find/Replace footnotes in Word document

stronk

New member
Joined
Dec 22, 2005
Messages
1
Programming Experience
Beginner
Hello everybody,

Can someone give me a solutions for this issue?

I have an application which generates a random contractnumber. By clicking the btnOpenWord it opens a Word document and must find and replace
a specified string in the Word document with the value in the clipboard.
Everything works till so far.

I have the following code:
PrivateSub btnOpenWord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenWord.Click
If Dir$(Application.StartupPath & "\OpenWord.doc") <> "" Then
Dim i AsInteger
Dim oWord AsObject
oWord = CreateObject("Word.Application")
oWord.Visible =
True
Dim thisDoc As Word.Document
Dim thisRange As Word.Range
oWord.Documents.Open(Application.StartupPath & "\OpenWord.doc")

oWord.Application.ActiveDocument.Content.Find.Execute(FindText:="Old text", ReplaceWith:="New text" Replace:=Word.WdReplace.wdReplaceAll)
Else
MessageBox.Show("Word document not found.")
EndIf

In this case every Old text will be replaced with the New text except the footnotes.

What code do I need to solve this?

Thanks.
 
Investigate ActiveDocument or use Object Browser, see if you got ActiveDocument.Footnotes or something of the like. (Note that I don't have access to the Word Object Library.)
 
Back
Top