I got help with a similar issue a while back (see post:
https://www.msofficeforums.com/word-...acro-help.html) and the resulting code has worked great for my needs! However, I would like to add a second "clickable button" that would do a slightly different task and I haven't had much luck finding the right tweaks to the code to make it work.
What I am trying to do is to search the document and have any text that is "(insert xyzabc emoji)" become highlighted in yellow with the click of the button. The xyzabc will vary from time to time and could contain up to several words but it would always be couched between "(insert" and "emoji)". Hopefully there is an easy solution to this!
Here is the code I have been working from. Any suggestions for edits are GREATLY appreciated!!
---
Private Sub Colorize_Hashtags_Button_Click()
' Colorize_Hashtags Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.Font
.Underline = wdUnderlineSingle
.Color = wdColorBlue
End With
With Selection.Find
.Text = "\#[A-Z,a-z,0-9]@>"
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.Find.Execute Replace:=wdReplaceAll
End Sub