Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

Issue with missingmember when trying to automate a mail merge to email.

$
0
0
Please find my a picture with the include code and an image of my error. I assume this is something simple. Thank you in advance for any help you might be able to give.

Attachment 98397

Imports Microsoft.Office.Interop
Public Class Form1

Public Sub BtnEmail_Click(sender As Object, e As EventArgs) Handles BtnEmail.Click
Dim WordApp As New Word.Application
Dim WordDoc As Word.Document
WordDoc = WordApp.Documents.Open("c:\temp\testmailmerge.docx")

' Set the mail merge data source to the relevant database.
WordDoc.ActiveDocument.MailMerge.OpenDataSource = "c:\temp\testsource.csv"

'Make word visible'
WordApp.Visible = True
WordApp = Nothing

With WordDoc.MailMerge
.Destination = Word.WdMailMergeDestination.wdSendToEmail
.MailAddressFieldName = "Email"
.MailSubject = "VB Test"
.SuppressBlankLines = True
End With
End Sub
End Class
Attached Images
 

Viewing all articles
Browse latest Browse all 27189

Trending Articles