View Single Post
 
Old 08-08-2019, 02:02 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote