Please excuse my ignorance, I’m just an old dog trying to learn new tricks and I can not get the dots to connect…
my mail merge docm + xlsx document connection works fine, my macro runs fine when manually run from the VBA editor, however I can not get it to run per mail merge record…
If i can just get Microsoft’s example working i can use it to learn how it works but I can’t even get the example on Microsoft’s website to work…
I am using Microsoft Office 2013.
This is what I am specifically trying to recreate to learn from:
https://learn.microsoft.com/en-us/office/vba/api/word.application.mailmergeafterrecordmerge
the entirety of my test code is as follows, I am sure I am missing some things so please specify exaclty what and exactly where so i can get this example code Microsoft provides working.
Thank you
Public WithEvents MailMergeApp As Word.Application
Private Sub MailMergeApp_MailMergeAfterRecordMerge(ByVal Doc As Document)
With Doc.MailMerge.DataSource
MsgBox .DataFields("FIRST_NAME").Value & " " & .DataFields(LAST_NAME).Value & " is merged."
End With
End Sub