I have an Excel program.
Which is manipulating a word document and find/replace text. My code looks like this
Dim wApp As Word.Application
Dim wDoc As Word.Document
Set wApp = CreateObject("Word.Application")
wApp.Visible = False
Set wDoc = wApp.Documents.Open(myFile)
With wDoc.Content.Find
.Text = "<Customer Name>"
.Replacement.Text = "Customer Name"
.Wrap = wdFindContinue
.MatchWholeWord = True
.Execute Replace:=wdReplaceAll
.Text = "<Billing Address>"
.Replacement.Text = "Billing Address"
.Wrap = wdFindContinue
.MatchWholeWord = True
.Execute Replace:=wdReplaceAll
End With
Which works perfectly.
However the word document has some words within a text box which I want to find and replace on, but I can't get it to work (the above code only searches the main body of the word document and not the text boxes)
I tried
wDoc.Shapes.Range(Array("Text Box 14")).Select
With wDoc.Selection.Find
.Text = "<Profile Code>"
.Replacement.Text = "Profile Code"
.Wrap = wdFindContinue
.MatchWholeWord = True
.Execute Replace:=wdReplaceAll
End With
but that didn't work. I got an Object doesn't support this property or method error message
Please help!