![]() |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
ksa5024 | Project | 1 | 06-15-2016 06:15 PM |
Is there an option to choose font color when replacing text in Excel 2003? | chr2014 | Excel | 8 | 11-14-2014 09:13 PM |
![]() |
WH7262 | Word VBA | 1 | 08-26-2014 03:46 PM |
![]() |
trevorhiller | Word | 1 | 04-14-2012 02:14 AM |
modifying rule to show new mail envelope in task bar | mlov83 | Outlook | 5 | 02-11-2011 01:36 PM |