如何将数据从excel中的第一行复制到最后一个内容行,并将其直接粘贴到Outlook正文中,然后将其发送“不使用任何其他临时excel”
答案 0 :(得分:0)
发送电子邮件消息的Outlook对象模型中的MailItem
类的Send方法。
以下是用于创建新MailItem并将其发送出去的示例VB.NET代码:
Private Sub CreateSendItem(Application As Outlook.Application)
Dim mail As Outlook.MailItem = Nothing
Dim mailRecipients As Outlook.Recipients = Nothing
Dim mailRecipient As Outlook.Recipient = Nothing
Try
mail = Application.CreateItem(Outlook.OlItemType.olMailItem)
mail.Subject = "A programatically generated e-mail"
mailRecipients = mail.Recipients
mailRecipient = mailRecipients.Add("Eugene Astafiev")
mailRecipient.Resolve()
If (mailRecipient.Resolved) Then
mail.Send()
Else
System.Windows.Forms.MessageBox.Show(
"There is no such record in your address book.")
End If
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message,
"An exception is occured in the code of add-in.")
Finally
If Not IsNothing(mailRecipient) Then Marshal.ReleaseComObject(mailRecipient)
If Not IsNothing(mailRecipients) Then Marshal.ReleaseComObject(mailRecipients)
If Not IsNothing(mail) Then Marshal.ReleaseComObject(mail)
End Try
End Sub
您可能会找到How To: Create and send an Outlook message programmatically文章。
在Outlook中使用正文的主要方法有三种:
您可以在Chapter 17: Working with Item Bodies中阅读有关此内容的更多信息。哪种方法由您决定。