Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am having issue when i use the destination as send to email to merge my word document to email, it ask for email address.

wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToEmail

please help.
Posted

Here is an example of a working solution that you could compare your code to:

http://www.vbforums.com/showthread.php?t=675601[^]

My thought would be that either you aren't bringing the email address of the user to send to into the document or that Word does not know who to send email out as. Try doing the merge to email manually and see if it works.
 
Share this answer
 
Hey Sumit

Yup, you will need to provide the TO email address during mail merge to send email. You can pass the email address to "MailAddressFieldName" parameter by equating to the column name containing email addresses with the datasource binded to mail merge doc.

Sample code below.


VB
With wrdApp.ActiveDocument.MailMerge
     .Destination = oWord.WdMailMergeDestination.wdSendToEmail
     .MailFormat = oWord.WdMailMergeMailFormat.wdMailFormatHTML
     .MailSubject = "Test mail "
     .MailAddressFieldName = "Email_Address"
     .MailAsAttachment = False
     .Execute(Pause:=False)
 End With


Hope it helps.

Nitin
 
Share this answer
 
Please have a check on Mail Merge in .NET[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900