Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-01-2016, 07:50 AM
kissingfrogs2003 kissingfrogs2003 is offline Need help with modifying a replacing font VBA code- similar task but subtle change Windows 7 64bit Need help with modifying a replacing font VBA code- similar task but subtle change Office 2016
Novice
Need help with modifying a replacing font VBA code- similar task but subtle change
 
Join Date: Jan 2016
Posts: 9
kissingfrogs2003 is on a distinguished road
Default Need help with modifying a replacing font VBA code- similar task but subtle change

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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with modifying a replacing font VBA code- similar task but subtle change Displaying Code in a task usage view 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
Need help with modifying a replacing font VBA code- similar task but subtle change Looping Macro to Change Font, Font Size, and Give Heading 1 WH7262 Word VBA 1 08-26-2014 03:46 PM
Need help with modifying a replacing font VBA code- similar task but subtle change Make Font Dropdown Change All Styles' Font 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

Other Forums: Access Forums

All times are GMT -7. The time now is 05:05 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft