View Single Post
 
Old 01-09-2022, 12:11 AM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default I don't know how to create a link to have you see the doc....

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
I can't yet code like Pro's and I don't know why your code on my side, didn't do what it was intended to do, but I found a way to accomplish my need. The Green color code, well, it's numbers, that is because I've recorded my steps, and it gave me that number code. I guess I would have to create one for the red one. Unless I try to encorporate part of your script to do ''or''. I'll try later.

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
Attached Files
File Type: docx tst a macro3.docx (45.2 KB, 6 views)

Last edited by Cendrinne; 01-09-2022 at 05:14 PM. Reason: uploaded the word document
Reply With Quote