Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / December 2005

Tip: Looking for answers? Try searching our database.

How to Setup an Event Processor

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chaplain Doug - 29 Dec 2005 17:18 GMT
Word 2003.  I would like to use the MailMergeBeforeRecordMerge event with my
mailmerge document.  How do I set this up so that it is triggered each time
before a new merge record is processed.  I tried placing the exmaple code in
the code space for ThisDocument, but it does not work that way.  The code is:

Private Sub MailMergeApp_MailMergeBeforeRecordMerge(ByVal Doc As Document,
Cancel As Boolean)
  Static LastGolfer As String
  Dim intZipLength As Integer, CurrentGolfer As String
  intZipLength = Len(ActiveDocument.MailMerge.DataSource.DataFields(6).Value)
  'Cancel merge of this record only if
  'the zip code is less than five digits
  If intZipLength < 5 Then
        Cancel = True
  End If
End Sub

Signature

Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org

Doug Robbins - Word MVP - 30 Dec 2005 10:20 GMT
It sounds like you might be using a hammer to crack a nut.  You may be able
to do what you want by using the Skip Record If field, checking for the
value of the sixth data field.

However,  see the "Individual Merge Letters" item on fellow MVP Graham Mayor's
website at:

http://www.gmayor.com/individual_merge_letters.htm

If you are using Word XP or later, the "Add-in to Merge Letters to Separate
Files" that I have written and that can be downloaded from that site will
allow you to create each letter as a separate file with a filename taken
from a field in the data source with a minimum of fuss.

If you study all of the code in that add-in you may get an idea how to get
the event processor to work.

Note, you will also need to have followed the information in the article
"Writing application event procedures" at:

http://www.word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Word 2003.  I would like to use the MailMergeBeforeRecordMerge event with
> my
[quoted text clipped - 17 lines]
>   End If
> End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.