I have a variable (strLastname) that I use to send a string to a bookmark. That works well. I also wish to use that variable to replace temporary text "Name>" in a long document.
This is what I have now.
Sub cmdOK_Click()
Dim strLastname As String ' from dialogue box "BoxLastname" field
strLastname = BoxLastname.Value
....
End sub
The macro that does not work:
Sub ClientName()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Name>"
.Replacement.Text = strLastname??????
'Selection.TypeText (strLastname) ????
'How to use the variable from the Dialogue Box - strLastname????
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
I tried
.Replacement.Text = strLastname and .Replacement.Text = BoxLastname.Value
but no one work.