Automating Mail Merge/Sending to Email

J

JohnJohn

Hello.

I am using the Visual Basic and the Microsoft Word 11.0 Object Library to
automate mail merge and send the output via email. I have almost everything
working. I used Microsoft's examples to figure out how to do this. I ran
the following example code right from
http://msdn.microsoft.com/library/d...tml/woproMailAddressFieldName1_HV05211939.asp:

With Documents("FormLetter.doc").MailMerge
.MailAddressFieldName = "Email"
.MailSubject = "Amazing offer"
.Destination = wdSendToEmail
.Execute
End With

....having filled in all the merge fields appropriately. Upon the .Execute
call, I get the following prompt:

"A program is trying to automatically send e-mail on your behalf.
Do you want to allow this? If this is unexpected, it may be a virus and you
should choose "No"."

I click "Yes" to allow the email. It APPEARS that it's working, but no
email is ever sent or received by any of the recipients. I assume that it's
using Outlook to send the email, and none of the messages ever appear in the
out box or in sent messages, and none are ever received.

Am I missing something?

Thanks for sitting there and reading this long email!

John
 
J

Jezebel

You need to clear the Outlook message cache before calling the mail
function. Insert this line immediately before the MailMerge statement:

Kill "C:\Program Files\Microsoft Office\OFFICE11\*.*"
 
J

JohnJohn

Ummm...that's where a lot of application extensions, and WINWORD.EXE are,
among many other important files. You sure you got the right directory or
are you yanking my chain? :)

John
 
J

Jezebel

Just try it. You'll be fine.



JohnJohn said:
Ummm...that's where a lot of application extensions, and WINWORD.EXE are,
among many other important files. You sure you got the right directory or
are you yanking my chain? :)

John
 
J

JohnJohn

Anyone have any *helpful* advice as opposed to *malicious*. Good thing most
of us in here are smarter than you, Jezebel.
 
D

Doug Robbins

Jezebel is a knowledgable and frequent poster to these newsgroups and is not
known for providing *malicious* advice as opposed to *helpful* advice.

I can't pass any comment on what he suggested you try other than, provided
you do not have any unsaved work at the time that you try it, it can't do
any harm.



--
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
 
J

JohnJohn

Uh. No. You guys are nuts if you want me to delete Microsoft Word and all
its supporting DLLs and other extensions in order to make mail merge work.
lol
 
J

Jezebel

As perhaps you've worked out by now, the consensus is that someone who wants
to send bulk emails with a subject line 'amazing offer' is the very dregs of
humanity.

May your haemorrhoids hang like grapes!
 
J

John

PMFJI, and so late at that, but, Jezebel, I think you might owe the OP an
apology.

The code he quotes is from the page he pointed at. Word for word.
 
Top