Quote:
Originally Posted by Guessed
This seems to work:
Code:
Sub listIncluded()
Dim iLast As Long, iCount As Long
With ActiveDocument.MailMerge.DataSource
.ActiveRecord = wdLastRecord
iLast = .ActiveRecord '' Store index of the last active record for later use
.ActiveRecord = wdFirstRecord
Do
iCount = iCount + 1
Debug.Print .ActiveRecord
DoEvents
.ActiveRecord = wdNextRecord
Loop Until .ActiveRecord = iLast
MsgBox "There are " & iCount & " active records out of " & .RecordCount
End With
End Sub
Full Disclosure: I didn't invent this code. I sourced it from here vba - How can get a list of included records in a Word Mail Merge Document? - Stack Overflow and made a small adjustment so I could understand it better.
|
This is very interesting! Thank you! Not completely fool proof (e.g. if you only select one record then it bugs out) but I think I could play with this code and get it to work. Thanks so much