![]() |
#1
|
|||
|
|||
![]()
I'd like to do a search & replace for only colored text (e.g. user defined RGB code: 255 0 0) via a macro.
I know that this could be achieved without a macro, by going through a sequence of elaborate mouse clicks on the search and replace pane (more -> format -> font -> ... ). But this would be burdensome and time consuming when I have to do it numerous times for a repetitive task. Thereby, I'd like to perform a pre-formatted find & replace by setting up the find & replace pane with font color type, preferably triggered by only a few keystrokes (macro short cut that is equivalent to a ctrl+h plus font color specification). |
#2
|
||||
|
||||
![]()
Have you tried recording a macro to do this?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
I certainly did.
1. Click on Record macro 2. Press ctrl+h (set user defined RGB values: more -> format -> font -> ... ) 3. Press "cancel" to exit the find & replace pane (else the recording can't be terminated) 4. Click on Stop Recording 5. Run the created macro (but nothing happens). FYI, the macro recording can't be terminated without pressing the cancel button, which is the real problem here. The "find what" and "replace with" fields should be left clear of course, in order to emulate the generic ctrl+h function. I don't want the macro to limit the find & replace function to a specific search text, which then would be no-brainer. |
#4
|
||||
|
||||
![]()
Well, unless you click something other than 'Cancel', Find/Replace won't do anything, so neither would your recorded macro. That, too, should be a no-brainer.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
I already clicked for font color. If this is not then, please elaborate on your "something other than cancel?" Or are your saying that without leaving the find & replace pane, the macro recording can't be terminated?
|
#6
|
||||
|
||||
![]()
Unless you click on 'Replace', 'Replace All' or 'Find Next', stead of clicking on 'Cancel', all you're doing is aborting the Find/Replace, so nothing will be recorded. If you look at your recorded code, that's what you'd see - nothing about colours, etc. - probably just an empty macro.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
jc491 | Word VBA | 14 | 01-06-2016 08:57 PM |
Macro to keep formatted form fields after mail merge or replace text with formatted form fields | jer85 | Word VBA | 2 | 04-05-2015 10:00 PM |
![]() |
Hoxton118 | Word VBA | 7 | 06-10-2014 05:05 AM |
![]() |
paulkaye | Word | 4 | 12-06-2011 11:05 PM |
![]() |
shabbaranks | Excel | 4 | 03-19-2011 08:38 AM |