![]() |
|
#2
|
||||
|
||||
|
If you mean in the merge document itself then the following macro will do that.
Code:
Sub Macro1()
Dim oCell As Cell
Dim oFld As Field
For Each oCell In ActiveDocument.Tables(1).Range.Cells
For Each oFld In oCell.Range.Fields
If oFld.Type = wdFieldMergeField Then
If InStr(1, oFld.Code, "Product") > 0 Or _
InStr(1, oFld.Code, "Desc") > 0 Then
oCell.Shading.BackgroundPatternColor = wdColorWhite
Exit For
Else
oCell.Shading.BackgroundPatternColor = &HD9D9D9
End If
End If
Next oFld
Next oCell
lbl_Exit:
Set oCell = Nothing
Set oFld = Nothing
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Word background colour ignores Windows setting | wiganken | Word | 1 | 07-19-2018 09:25 AM |
Changing background colour based on dropdown choice
|
PLeo | Word VBA | 2 | 08-03-2017 07:40 AM |
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 |
| Word VBA Find Table Text Shading Colour and replace with another | QA_Compliance_Advisor | Word VBA | 10 | 09-19-2014 08:36 AM |
| Trying to clear the background colour from a theme | ezekiel181 | Word | 1 | 11-14-2010 07:29 AM |