Automation, Mail Merge and Event Handling

M

Matthew230

Hi,

I am struggling with the MS Word's event handling system.

I am trying to create a document that automates an email merge right up
until the user selects wizard stage 6 'Email Merge' (The reason is that is
the user selects it then it doesn't give the "application sending email on
your behalf" secuirty issues.

The problem is that I want things to happen after the mailmerge, and there
is the event handler. I can get it working fine when the document if first
opened, however as soon as the mail merge data is added and the document type
changed to wdemail, it seems to forget that there are events to be done, it
also loses all of it's variables, almost as if it has terminated and
restarted without regaining the variable values. I've tried re-calling the
eevnt handler register at every opportunity, but still it seems to forget.

Any help of this much appreciated as it is drving me nuts.

Matt
 
D

Doug Robbins - Word MVP

Perhaps it would be better if you were to tell us what it is that you want
to happen after the mail merge.

You will see mail merge events at work in the addin to create separate
documents from a mail merge with the file names taken from a field in the
data source that you can down load from fellow MVP Graham Mayor's website
at:

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

You can also get around the security issue by using the Express Click Yes
utility that is mentioned in the article "Mail Merge to E-mail with
Attachments" at:

http://word.mvps.org/FAQs/MailMerge/MergeWithAttachments.htm


--
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, originally posted via msnews.microsoft.com
 
M

Matthew230

Hi Doug,

Thank you for your reply.

I've worked it out. Whilst command buttons were being deleted elsewhere in
the code, the variables reset themselves, ie no event handlers registered. I
had to run the code line by line to check this, didn't give an error whilst
running !!

Matt
 

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