I am trying to create a routine which will search for multiple words in MSWord documents and replace them with user specified text which are entered in textboxes. The search words were defined as constants (T1 and T2) below. My sub does not produce any errors but the search word text is not replaced in the document. I have attached a copy of my script below. Any help sorting this out would be much appreciated.
Private Sub Replace_text_multiple()
Const T1 = "project"
Const T2 = "address"
For i = 1 To 2
With ActiveDocument.Content.Find
.Text = T & i
With .Replacement
.Text = Me.Controls("Textbox" & i).Value
End With
.Execute Replace:=wdReplaceAll
End With
Next
End Sub
Private Sub Replace_text_multiple()
Const T1 = "project"
Const T2 = "address"
For i = 1 To 2
With ActiveDocument.Content.Find
.Text = T & i
With .Replacement
.Text = Me.Controls("Textbox" & i).Value
End With
.Execute Replace:=wdReplaceAll
End With
Next
End Sub