Function AddOutLookTask() Dim appOutLook As Outlook.Application Dim taskOutLook As Outlook.TaskItem Set appOutLook = CreateObject("Outlook.Application") Set taskOutLook = appOutLook.CreateItem(olTaskItem) With taskOutLook .Subject = "This is the subject of my task" .Body = "This is the body of my task." .ReminderSet = True .ReminderTime = DateAdd("n", 2, Now) ' Set to remind us 2 ' minutes from now. .DueDate = DateAdd("n", 5, Now) ' Set the due date to ' 5 minutes from now. .ReminderPlaySound = True 'add the path to a .wav file on your computer. .ReminderSoundFile = "C:\Win95\media\ding.wav" .Save End With End Function Sub AssignTask() Dim myItem As Outlook.TaskItem Dim myDelegate As Outlook.Recipient Set MyItem = Application.CreateItem(olTaskItem) MyItem.Assign Set myDelegate = MyItem.Recipients.Add("Dan Wilson") myDelegate.Resolve If myDelegate.Resolved Then myItem.Subject = "Prepare Agenda For Meeting" myItem.DueDate = Now + 30 myItem.Display myItem.Send End If End Sub
From novice to tech pro — start learning today.