View Single Post
 
Old 04-25-2024, 03:23 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,138
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 ofgmayor has much to be proud of
Default

Another way would be to employ Merge Many To One

This entails a small modification to the merge document (attached) and a macro (below) run from the add-in to place the check boxes. The result is in the result document example (attached). Sort the data on the customer field(attached) and that is the key field and filename field. The rest of the fields are child fields..

Code:
Sub AddChecks(oDoc As Document)
Dim oTable As Table
Dim oRng As Range
Dim i As Long, j As Long
    Set oTable = oDoc.Tables(1)
    On Error Resume Next
    For i = 2 To oTable.Rows.Count
        For j = 6 To 7
        Set oRng = oTable.Cell(i, j).Range
            oRng.End = oRng.End - 1
            oDoc.ContentControls.Add wdContentControlCheckBox, oRng
        Next j
    Next i
End Sub
Attached Files
File Type: docx Sample Letter.docx (37.7 KB, 8 views)
File Type: xlsx Mail Merge Data.xlsx (73.6 KB, 6 views)
File Type: docx Result.docx (30.8 KB, 10 views)
__________________
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