-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
31 lines (25 loc) · 1.01 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Imports DevExpress.XtraEditors
Imports DevExpress.XtraRichEdit
Imports Outlook = Microsoft.Office.Interop.Outlook
Imports System
Namespace MailMergeEmail
Public Partial Class Form1
Inherits XtraForm
Private server As RichEditDocumentServer
Public Sub New()
InitializeComponent()
server = New RichEditDocumentServer()
server.LoadDocument("MailMergeSimple.docx")
End Sub
Private Sub SendAnEmail()
Dim application As Outlook.Application = New Outlook.Application()
Dim mailItem As Outlook.MailItem = CType(application.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)
Dim exporter As RichEditMailMessageExporter = New RichEditMailMessageExporter(server, mailItem)
exporter.Export()
mailItem.Display(False)
End Sub
Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
SendAnEmail()
End Sub
End Class
End Namespace