Hi all-
I am pretty new to visual basic to please excuse my lack of knowledge on correct nomenclature
I have created a code in Excel VBA to open up a template word document and find/replace information in Word with the variables I have created in Excel. This code worked for one program and when I copied it over to create another one it just goes through the steps without finding/replacing anything. No error messages pop up, it just does not work. Here is my code below:
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open("C:\Users\" & UserID & "\Desktop\Quantien Evaluation Template 9.5.docx")
'FIND AND REPLACE TEXT
With wrdApp.Selection.Find
.Text = "[CustomerName]"
.Replacement.Text = CustomerName
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wrdApp.Selection.Find.Execute Replace:=wdReplaceAll
I am pretty new to visual basic to please excuse my lack of knowledge on correct nomenclature

I have created a code in Excel VBA to open up a template word document and find/replace information in Word with the variables I have created in Excel. This code worked for one program and when I copied it over to create another one it just goes through the steps without finding/replacing anything. No error messages pop up, it just does not work. Here is my code below:
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open("C:\Users\" & UserID & "\Desktop\Quantien Evaluation Template 9.5.docx")
'FIND AND REPLACE TEXT
With wrdApp.Selection.Find
.Text = "[CustomerName]"
.Replacement.Text = CustomerName
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wrdApp.Selection.Find.Execute Replace:=wdReplaceAll