MailMerge Events does not raise

C

Camerling

I am using a publisher document that does well in catalog 'mode', DataSource
is OK and filling when fusionning is OK.
So now I would like to do something when reading each record.
I have found that I can do that by using MailMerge events.
But it does not raise event, I mean my code, the msgbox for instance, is not
played.

Here is the code I use :

ThisDocument (code) :
Dim objPub As New clsPublisher

Private Sub Document_Open()
Call Register_Event_Handler
objPub.MergeProcess
End Sub

Sub Register_Event_Handler()
Set objPub.appPub = Publisher.Application
End Sub

The class clsPublisher code :
Public WithEvents appPub As Publisher.Application

Private Sub appPub_MailMergeBeforeRecordMerge(ByVal Doc As Document, Cancel
As Boolean)
MyAnswer = MsgBox("Event : MailMergeBeforeRecordMerge, stop ?", vbYesNo,
"Question ?")
If MyAnswer = 6 Then End
End Sub

Sub MergeProcess()
appPub.ActiveDocument.MailMerge.Execute Pause:=False, _

Destination:=pbMergeToNewPublication
End Sub

So What do I do wrong ?

Thx.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top