Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2016, 12:20 PM
kissingfrogs2003 kissingfrogs2003 is offline Can a macro help with this? Windows 7 64bit Can a macro help with this? Office 2016
Novice
Can a macro help with this?
 
Join Date: Jan 2016
Posts: 9
kissingfrogs2003 is on a distinguished road
Default Can a macro help with this?

Relatively new to macros in word so I'm not sure if there is a functionality that allows for this and if so, need some help figuring out how to write it.



I have paragraphs of text in which I have "hashtags." These are written out as #blahblahblah. What I am hoping to do is run a macro that will look for these #text strings and change the font on the whole "word" (symbol included) to be a different color so they stand out. There are multiple hashtags that change often so a simple "search and change" approach won't work I don't think.

Any advice?
Reply With Quote
  #2  
Old 01-13-2016, 02:36 AM
macropod's Avatar
macropod macropod is offline Can a macro help with this? Windows 7 64bit Can a macro help with this? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I don't see why a simple Find/Replace wouldn't work, where:
Find = #blahblahblah
Replace = ^&
and you specify the replacement font colour of your choice.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-13-2016, 09:19 AM
kissingfrogs2003 kissingfrogs2003 is offline Can a macro help with this? Windows 7 64bit Can a macro help with this? Office 2016
Novice
Can a macro help with this?
 
Join Date: Jan 2016
Posts: 9
kissingfrogs2003 is on a distinguished road
Default

Well I don't think that will work. I have over 20 different #xyz strings and they change every few weeks so I can't enter an individual "find" code for each one. Is there any way to search for "#" and any text attached to it...regardless of what that text is, as long as there is always a # as the "first letter"?
Reply With Quote
  #4  
Old 01-13-2016, 02:24 PM
macropod's Avatar
macropod macropod is offline Can a macro help with this? Windows 7 64bit Can a macro help with this? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Sure you can! Use a wildcard Find/Replace, where:
Find = \#[a-z]@>
Replace = ^&
and specify the replacement font colour of your choice.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 01-13-2016, 02:46 PM
kissingfrogs2003 kissingfrogs2003 is offline Can a macro help with this? Windows 7 64bit Can a macro help with this? Office 2016
Novice
Can a macro help with this?
 
Join Date: Jan 2016
Posts: 9
kissingfrogs2003 is on a distinguished road
Default

When i tried copy and pasting "\#[a-z]@>" into the find bar of the find and replace menu option it gives me errors saying it can't find anything in the document. Am I doing something wrong?
Reply With Quote
  #6  
Old 01-13-2016, 06:47 PM
macropod's Avatar
macropod macropod is offline Can a macro help with this? Windows 7 64bit Can a macro help with this? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Did you check the 'use wildcards' option?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 01-14-2016, 08:02 AM
kissingfrogs2003 kissingfrogs2003 is offline Can a macro help with this? Windows 7 64bit Can a macro help with this? Office 2016
Novice
Can a macro help with this?
 
Join Date: Jan 2016
Posts: 9
kissingfrogs2003 is on a distinguished road
Default

That did the trick! I'm gonna try recording a macro while I do this so it will be "automated" with a command button. Thanks!
Reply With Quote
  #8  
Old 01-14-2016, 08:10 AM
kissingfrogs2003 kissingfrogs2003 is offline Can a macro help with this? Windows 7 64bit Can a macro help with this? Office 2016
Novice
Can a macro help with this?
 
Join Date: Jan 2016
Posts: 9
kissingfrogs2003 is on a distinguished road
Default

Wait....spoke to soon... it DIDN'T catch them all. For some reason it caught all the ones listed as "#mentalhealthstigma" or "#compliments" (etc.) but didn't replace the any of the ones that start with "#TAMUCC"...is this because of capital letters or something else? Is there a way to fix it?

Here is a link to the document I am working with, if that is helpful: https://www.dropbox.com/s/g10lc8dgwr...osts.docx?dl=0
Reply With Quote
  #9  
Old 01-14-2016, 09:17 AM
kissingfrogs2003 kissingfrogs2003 is offline Can a macro help with this? Windows 7 64bit Can a macro help with this? Office 2016
Novice
Can a macro help with this?
 
Join Date: Jan 2016
Posts: 9
kissingfrogs2003 is on a distinguished road
Default

Kinda feeling proud like I may have figured it out....

Searching for "\#[A-Z,a-z]@>" seems to have done the trick from what I can tell *overjoyed!*
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to add title in header is missing text once macro is run shawnee24 Word VBA 3 05-27-2015 12:35 PM
Can a macro help with this? Macro Question: Need help making a macro to highlight the first word in every sentence LadyAna Word 1 12-06-2014 10:39 PM
Macro Needed to bold specific lines and Macro to turn into CSV anewteacher Word VBA 1 05-28-2014 03:59 PM
custom icon, undo/redo for macro, permanent macro Rapier Excel 0 08-05-2013 06:30 AM
How do I assign a macro to a button when the macro is in my personal workbook? foolios Excel Programming 2 07-27-2011 02:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:19 PM.


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