Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-18-2018, 03:02 AM
catflap's Avatar
catflap catflap is offline Mail Merge Events Windows 7 64bit Mail Merge Events Office 2013
Advanced Beginner
Mail Merge Events
 
Join Date: Aug 2015
Location: UK
Posts: 72
catflap is on a distinguished road
Default Mail Merge Events

From some googling I've found that there's a bit of a problem when using the MailMergeAfterMerge event and MailMergeBeforeMerge event in that they don't trigger if you start the merge from the toolbar icon.

I was just wondering if anyone ever found a way around this issue, so the events fire at the start/end of a merge however it's started?

Thanks
Reply With Quote
  #2  
Old 04-18-2018, 03:15 AM
eduzs eduzs is offline Mail Merge Events Windows 10 Mail Merge Events Office 2010 32bit
Expert
 
Join Date: May 2017
Posts: 262
eduzs is on a distinguished road
Default

Did you try to put the sub in ThisDocument code windows instead of in a module?
Give a try.
Also provide your code here so someone can help.
__________________
Backup your original file before doing any modification.
Reply With Quote
  #3  
Old 04-18-2018, 03:29 AM
catflap's Avatar
catflap catflap is offline Mail Merge Events Windows 7 64bit Mail Merge Events Office 2013
Advanced Beginner
Mail Merge Events
 
Join Date: Aug 2015
Location: UK
Posts: 72
catflap is on a distinguished road
Default

Thanks for your response.

I'm aiming to use this for any document, so I can't really put it in the ThisDocument code. I did try it anyway, but it still didn't fire there either.

There's not really any code at the moment, I'm just trying to see if I can get anything to trigger before going further, so for now it's just:

Code:
Private Sub app_MailMergeBeforeMerge(ByVal Doc As Document, ByVal StartRecord As Long, ByVal EndRecord As Long, Cancel As Boolean)

    MsgBox "Merge has started."

End Sub
I'm declaring app in my class module:

Code:
Public WithEvents app As Word.Application
Reply With Quote
  #4  
Old 04-18-2018, 03:34 AM
macropod's Avatar
macropod macropod is offline Mail Merge Events Windows 7 64bit Mail Merge Events Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by eduzs View Post
Did you try to put the sub in ThisDocument code windows instead of in a module?
You really would'nt want to do that; that's a sure way of guaranteeing the MailMergeAfterMerge macro won't work. Event macros of this kind must be used in a properly initiated Class module.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 04-18-2018, 03:50 AM
macropod's Avatar
macropod macropod is offline Mail Merge Events Windows 7 64bit Mail Merge Events Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by catflap View Post
I'm just trying to see if I can get anything to trigger before going further, so for now it's just:

Code:
Private Sub app_MailMergeBeforeMerge(ByVal Doc As Document, ByVal StartRecord As Long, ByVal EndRecord As Long, Cancel As Boolean)

    MsgBox "Merge has started."

End Sub
The MailMergeBeforeMerge code in the VBA help file works fine for me. After adding the code, did you exit & re-start Word before trying to run the merge.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 04-18-2018, 04:12 AM
catflap's Avatar
catflap catflap is offline Mail Merge Events Windows 7 64bit Mail Merge Events Office 2013
Advanced Beginner
Mail Merge Events
 
Join Date: Aug 2015
Location: UK
Posts: 72
catflap is on a distinguished road
Default

Doh!

I didn't realise that would be necessary - works fine for me too now.

Many thanks for your time.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge Events How do I mail merge records into table columns with more than one merge field? tech123 Mail Merge 1 04-26-2017 07:13 PM
Mail Merge Events Mail Merge is Deleting objects in my header and footer during the merge bgranzow Mail Merge 9 06-05-2015 05:03 AM
Mail merge how to link mail merge field value to a column heading dsummers Mail Merge 1 05-08-2014 02:59 PM
Mail Merge Duplication of address on merge RICKY Mail Merge 1 09-26-2012 03:14 PM
Mail Merge Events Saving INDV mail merges During the mail merge sedain121 Mail Merge 2 10-04-2011 07:52 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:06 AM.


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