#1
|
|||
|
|||
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? |
#2
|
||||
|
||||
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] |
#3
|
|||
|
|||
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"?
|
#4
|
||||
|
||||
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] |
#5
|
|||
|
|||
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?
|
#6
|
||||
|
||||
Did you check the 'use wildcards' option?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
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!
|
#8
|
|||
|
|||
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 |
#9
|
|||
|
|||
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!* |
|
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 |
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 |