That code is written for PCs. I don't know how well it would work on a Mac. In any event, the DATABASE field approach discussed on the
Microsoft Word Catalogue/Directory Mailmerge Tutorial page (
https://www.msofficeforums.com/mail-...-tutorial.html) would seem to be a better approach. It works with emails and, provided your data source is set up appropriately, doesn't need a macro to tabulate the data. The only thing it doesn't do 'out of the box' is tally the columns, but a macro could be used to deal with that.
For some more DATABASE field examples, see:
MS Answers : Mail Merge - To a Word Table on a Single Page
MS Answers : Many to one email merge using tables