Consulting

Results 1 to 4 of 4

Thread: Running vba code for each record in a mail merged document

  1. #1

    Running vba code for each record in a mail merged document

    I thought I would post this separately as it's a different question.

    I have a mail merged letter. I can run some vba code when the document opens and this alters some aspects of the initial opened document. As I click through the different records the original info comes back replacing the vba edited content.

    Is there a way to get the vba code to run each time I click on a different record?

  2. #2
    The short answer is no, but you could split the merge (or the merged document) and run a macro on the individual documents.
    https://www.gmayor.com/individual_merge_letters.htm, https://www.gmayor.com/MergeAndSplit.htm and https://www.gmayor.com/ManyToOne.htm all provide an option to merge to separate documents and run a macro. The macro does however have to conform to a particular format described on the web pages and in the help files.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    Could I add a macro button to print and just add the image changing code to that?

    Edit: seems I can create a macro button and link to the quick access toolbar.
    Last edited by Agent Smith; 06-06-2019 at 02:39 PM.

  4. #4
    Why do you need to change images? Why not merge the images - https://www.gmayor.com/mail_merge_graphics.htm and https://www.gmayor.com/mail_merge_graphics_addin.htm ?
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •