Create and assign an outlook task using VBA?

  • Follow


I have code that creates an Outlook task for me.  I want to be able to 
automatically assign a task to a certain e-mail address recipient.  Is this 
possible?  It seems that the right properties are available, but I can't 
seem to get it to work.  Here is my code...

Private Sub Create_It_Click()
    'Create the Task in Outlook
    On Error GoTo AddAppt_Err
       Dim outobj As Outlook.Application
       Dim outtask As Outlook.TaskItem
       'Dim objApptOccur As TaskItem

       Set outobj = CreateObject("outlook.application")
       Set outtask = outobj.CreateItem(olTaskItem)
       With outtask
            .subject = Me!subject
            .Body = Me!txtBody
            Select Case cmbImportance
                Case "High"
                    .Importance = olImportanceHigh
                Case "Normal"
                    .Importance = olImportanceNormal
                Case "Low"
                    .Importance = olImportanceNormal
            End Select
            .Assign  'This seems to set the task to be assigned
            outtask.Display
       End With
    ' Release the Outlook object variable.
    Set outobj = Nothing
    DoCmd.Close
    Exit Sub

The code creates a task, inputs the subject, body, and importance, and sets 
the task to be assigned.  I just can't seem to automatically put in the 
e-mail address in the "To:" field.  I thought that it might be '.recipients 
= "e-mail address"' but that didn't work.  Any ideas?  Thanks!!!

Todd 


1
Reply Todd 7/25/2007 3:52:39 AM


0 Replies
1666 Views

(page loaded in 0.02 seconds)

Similiar Articles:
















7/23/2012 4:31:35 PM


Reply: