View Single Post
 
Old 07-26-2021, 04:51 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
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

There is no simple VBA function that will give you this information. A workaround method for a letters merge document would be to merge to a new document and count the sections e.g.
Code:
Sub CountRecipients()
Dim lngCount As Long, i As Long
Dim oDoc As Document
    If ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument Then
        MsgBox "The active document is not a merge document?", vbCritical
        Exit Sub
    End If
    With ActiveDocument.MailMerge
        .Destination = wdSendToNewDocument
        .SuppressBlankLines = True
        With .DataSource
            .FirstRecord = wdDefaultFirstRecord
            .LastRecord = wdDefaultLastRecord
        End With
        .Execute Pause:=False
    End With
    Set oDoc = ActiveDocument
    lngCount = oDoc.Sections.Count - 1
    oDoc.Close 0
    MsgBox lngCount
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