Does anybody know how I can embedd an email item into a task? it woudl be the equivalent of dragging the email into the opened task form. I haven't been able to track down the object I can use to do this.
many thanks,
Lj.
Printable View
Does anybody know how I can embedd an email item into a task? it woudl be the equivalent of dragging the email into the opened task form. I haven't been able to track down the object I can use to do this.
many thanks,
Lj.
Welcome to the Forums.
Here is how you would do it.
VB Code:
Option Explicit 'Add a reference to MS Outlook xx.0 Object Library Private Sub Command1_Click() Dim oApp As Outlook.Application Dim oNS As Outlook.NameSpace Dim oTask As Outlook.TaskItem Dim oEmail As Outlook.MailItem Set oApp = New Outlook.Application Set oNS = oApp.GetNamespace("MAPI") Set oTask = oApp.CreateItem(olTaskItem) oTask.Subject = "Attached Email" oTask.Save Set oEmail = oApp.CreateItem(olMailItem) oEmail.Subject = "Test" oEmail.Save oTask.Attachments.Add oEmail, olByValue, 1, oEmail.Subject oTask.Save oTask.Display End Sub