Email merge Address To field not filling in

  • Thread starter msnews.microsoft.com
  • Start date
M

msnews.microsoft.com

I have been attempting to fill in the TO: field on a merged document without
sucess. Below is the code that I am using. The document merge works fine
with the main document body. However, the top portion of the document that
cotains the TO: field, Subject: field, etc. is not being filled in. I have
used the following short segment of code in an attempt to make this work:
Can anyone tell me what else can be happening. The datasource contains the
"E-mail" field and it is populated. All the main document fields work fine.
Any help would be greatly appreciated. Thank you.

wrdApp.DefaultSaveFormat = "Doc"

With wrdApp.ActiveDocument.MailMerge
..Destination = Word.WdMailMergeDestination.wdSendToEmail
..MailAsAttachment = False
..MailAddressFieldName = "E-mail"
..MailSubject = ""
..SuppressBlankLines = False
With .DataSource
..FirstRecord = .FirstRecord
..LastRecord = .LastRecord
End With
..Execute(Pause:=True)
End With
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi PK,

Try replacing

.Destination = Word.WdMailMergeDestination.wdSendToEmail

with

.Destination = wdSendToEmail

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
M

msnews.microsoft.com

That does not seem to help. Thank you for looking at it.


"Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS"
 
C

Cindy M -WordMVP-

Hi Msnews.microsoft.com,

You're obviously automating Word from another app. Which environment is this?
(So that we know in what programming language we should be thinking)

Like Doug, I find the .Destination line suspect. As you're automating, I think
you may need to use wrdApp.wdSendToEmail there. Although if this is .NET,
maybe not.

Could you clarify what you mean by "the top portion of the document"? Do you
have mergefields inserted into the header? Or are you looking at the "Email
envelope" toolbar area? Or something else?

Which version of Word are you automating? And to what email program should the
mail merge result be sent?

If you comment out the .Execute and let your application finish with the Word
document displayed and active, can you go in there as a user and send the
email?
I have been attempting to fill in the TO: field on a merged document without
sucess. Below is the code that I am using. The document merge works fine
with the main document body. However, the top portion of the document that
cotains the TO: field, Subject: field, etc. is not being filled in. I have
used the following short segment of code in an attempt to make this work:
Can anyone tell me what else can be happening. The datasource contains the
"E-mail" field and it is populated. All the main document fields work fine.
Any help would be greatly appreciated. Thank you.

wrdApp.DefaultSaveFormat = "Doc"

With wrdApp.ActiveDocument.MailMerge
..Destination = Word.WdMailMergeDestination.wdSendToEmail
..MailAsAttachment = False
..MailAddressFieldName = "E-mail"
..MailSubject = ""
..SuppressBlankLines = False
With .DataSource
..FirstRecord = .FirstRecord
..LastRecord = .LastRecord
End With
..Execute(Pause:=True)
End With

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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

Similar Threads


Top