vb.net中的Word 2007邮件合并 [英] Word 2007 mail merge in vb.net

查看:88
本文介绍了vb.net中的Word 2007邮件合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


当我使用目的地作为发送至电子邮件将我的Word文档合并到电子邮件时,出现问题,它询问电子邮件地址.

wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToEmail

请帮忙.

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.

推荐答案

下面是一个可行的解决方案示例,您可以将代码与以下内容进行比较:

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

我的想法是,要么您没有将要发送的用户电子邮件地址带入文档,要么Word不知道向谁发送电子邮件.尝试手动进行合并以通过电子邮件发送邮件,看看是否可行.
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.


嘿Sumit

是的,您需要在邮件合并过程中提供TO电子邮件地址才能发送电子邮件.您可以将电子邮件地址传递给& quot; MailAddressFieldName& quot;.参数,方法是等于包含电子邮件地址的列名,并将数据源绑定到邮件合并文档.

下面的示例代码.


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.


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



希望对您有所帮助.

Nitin



Hope it helps.

Nitin


请检查

这篇关于vb.net中的Word 2007邮件合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆