![]() |
|
|
|
#1
|
||||
|
||||
|
Without access to a sample table, it is difficult to progress this further. The code looks for cell content that is Bold and coloured red or green. Highlight is not the issue so much as the search criteria. Can you link an example document?
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#2
|
||||
|
||||
|
Hi Graham,
As I've mentioned previously, I don't know how to create a link to have you access to a sample of a document yet. Besides, I would have to do it with my own computer. Good news though I found a way to do it as a regular find and replace, by creating a Cell Style. And thank god, it didn't touch the Font Color nor the Highlighted Text, nor the Bold Font. ![]() I can share my script, however, I don't now how to share my style. But what I've done, is Select a Table Cell, and put it with the color of my choice, then instead of asking to Apply this to the Whole Table, I've requested to Apply it to the Top Left Cell, just as the image with the first table with a Red colored circle, from the link below: Workaround for styles with table cells in Word - Office Watch And here is my code script: Code:
Sub FNR_TXT_Selec_Cell_Put_Colr_Orange()
Selection.Find.ClearFormatting
Selection.Find.Highlight = True
With Selection.Find.Font
.Bold = True
.Color = 5287936 'Green
End With
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles( _
"Cell Colr Org para")
With Selection.Find
.Text = "&"
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Just glad, this script works for my need. I do thank you for helping me though. It's really really great of you ![]() Happy New Year my friend ![]() Cendrinne Last edited by Cendrinne; 01-09-2022 at 05:14 PM. Reason: uploaded the word document |
|
| Tags |
| macro help, shade a cell, word table macro |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Conditionally Shade Table Cells
|
S7ewie | Mail Merge | 8 | 04-29-2021 01:52 AM |
| Macro to change an RGB table cell shading color to another RGB color | David Matthews | Word VBA | 4 | 05-29-2018 02:45 PM |
Code to find a named (bookmarked?) table, replicate a row or table, and delete a specified table.
|
kevinbradley57 | Word VBA | 9 | 09-21-2017 04:58 PM |
Text area in table won't shade
|
LSHAW | Word Tables | 1 | 03-09-2017 03:08 PM |
VBA Table – Search All Tables - Find & Replace Text in Table Cell With Specific Background Color
|
jc491 | Word VBA | 8 | 09-30-2015 06:10 AM |