Task Attachments Are Not Being Displayed

G

Guest

Hi I have a program (thanks to Sue Mosher) that converts emails into tasks,
based on certain words in the subject line. It runs as an Outlook Rule.

It works fine except for the attachments. For some reason the attachments
that are being sent are not being displayed in the task that is generated.

Here is my code:


Sub MakeTaskFromMail(MyMail As Outlook.MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
Dim objTask As Outlook.TaskItem

strID = MyMail.EntryID

Set olNS = Application.GetNamespace("MAPI")

Set olMail = olNS.GetItemFromID(strID)

Set objTask = Application.CreateItem(olTaskItem)
With objTask
.Subject = olMail.Subject
.DueDate = DateAddW(olMail.SentOn, 5)
.ReminderTime = DateAddW(olMail.SentOn, 4)
.Importance = olImportanceHigh
.Body = olMail.Body
.Attachments = olMail.Attachments <-WHERE I'M HAVING TROUBLE!

End With

olMail.Delete

objTask.Save

Set objTask = Nothing
Set olMail = Nothing
Set olNS = Nothing


End Sub


If any one can help here, it would be great!
 
M

Michael Bauer [MVP - Outlook]

Am Wed, 16 Aug 2006 19:02:01 -0700 schrieb Nick_NZ:

You must save the attachments as file first, then add them to the
Task.Attachments
 
S

Sue Mosher [MVP-Outlook]

Sounds like you eliminated the call to the CopyAttachments() function in the original sample. That function contains the essential functionality that Michael is referring to. See http://www.outlookcode.com/codedetail.aspx?id=959 for a complete sample.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top