I posted this question previously but didn't get any response. I'm trying to figure out how to send a Task Request via Excel VBA. I was able to get nearly all the way there by following the advice on *****-Clicks.com, although I did discover that you MUST bind the Outlook 10.0 object library FIRST (early binding) using Tools, References in the VBA editor. This seems to be true regardless of whether you include the binding code in your subroutine, it just won't work unless you manually bind it using Tools, References.
Now I'm nearly all the way there...see the code below. I can create the task request, and it is saved in the task list. Unfortunately the last step, Send, does not work...it attempts to send the request to the task recipient (Mark Walker), but you will get a VBA error asking for at least one name in the To: box. Unfortunately the .To method does not appear to be supported in the object dropdown list (as it is for the email type). The .Recipients method is supported but this does not work, VBA returns an error.
So all I need is a way to assign a .To recipient for this task request and I'm good to go! I've seen a number of postings on this forum on this topic, so I'm sure many users can benefit from this. Any help would be greatly appreciated, thanks!
Roy
Sub TestTask()
' Note: You must first manually bind the Outlook 10.0 Object Library by going to
' Tool, References in the VBA editor (this is for Outlook 2002). Otherwise the code
' below will not work!
Dim olApp As Object
Dim olTsk As TaskItem
Dim Recipient As String
Recipient = "Mark Walker"
Set olApp = CreateObject("Outlook.Application")
Set olTsk = olApp.CreateItem(olTaskItem)
With olTsk
.Status = olTaskInProgress
.Importance = olImportanceHigh
.DueDate = DateValue("06/26/05")
.Body = "Test task body"
.TotalWork = 40
.ActualWork = 20
.Assign = "Test Task Mark Walker"
.Owner = "Mark Walker"
.Save
.Send
End With
Set olTsk = Nothing
Set olApp = Nothing
End Sub
Bookmarks