Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 07-26-2021, 04:56 PM
Guessed's Avatar
Guessed Guessed is offline Record count on merge Windows 10 Record count on merge Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,164
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 

Tags
mail, merge, record



Similar Threads
Thread Thread Starter Forum Replies Last Post
Record count on merge Letter from Mail Merge Redundancy Record zidan3311 Mail Merge 3 10-04-2017 12:54 PM
Record count on merge Showing record number during mail merge catflap Mail Merge 1 04-13-2017 07:32 AM
Record count on merge Mail Merge Next Record If rule RHensley Mail Merge 10 03-07-2017 08:05 AM
avoid duplicete record and merge the record with the existed record hemant.behere Excel 0 01-10-2012 02:53 AM
How to count the frequency of data and also tally value from an array of Excel record KIM SOLIS Excel 5 09-07-2011 09:01 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:28 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft