Add VBA to clear text highlight during replace?
Posted on 2013-01-07
I am currently developing a template that will automatically replace text on a word document with text on a form. The document has all items that need to be replaced or edited highlighted. I am hoping to include in my vba some code that will unhighlight document text as it is replaced with word text.
Code snippet is as follows, so I would need to insert somewhere here I believe, what I have in there now is not getting rid of the highlight after the replace is done but is working to replace document text with form text:
Private Sub cmdCreateLetter_Click()
On Error Resume Next
Dim xCheckCounter As Long
Dim xCheckBoxName As Object
Dim ASOTemplate As Document
Set ASOTemplate = ActiveDocument
.Text = "[STATE CONTRACTING ENTITY]"
.Replacement.Text = txtState.Text
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False