Add Outlook Tasks
by Troy Blake
Category: Microsoft Office Apps/VBA
Compatability: Visual Basic 3.0
Date Added: Wed 3 February 2021
Rating: (7 Votes)
Used to show and add new tasks to Outlook. Simple code to demo getting task list and also adding a new task in Outlook. Please vote.
Create Reference to Outlook. Create a form, insert code. Also put a combobox on the form and name it cboTasklist. Load form at runtime to view current task list. Simple code to demo getting task list and also adding a new task. Not very useful as it is listed here, but you can see how you could change it to be a useful function. Please vote.
'Simple Outlook Task View/Add Code
'Troy Blake - Logan's Roadhouse, Inc.
Private Sub InitForm()
'Loads current task to dropdown, then adds
'a task for John Smith. John gets the task
'sent to him via Outlook.
Dim oApp as Outlook.Application
Dim oNspc as NameSpace
Dim oItm as TaskItem
Dim myItem as TaskItem
Set oApp = CreateObject("Outlook.Application")
Set oNspc = oApp.GetNamespace("MAPI")
For Each oItm in oNspc.GetDefaultFolder(olFolderTasks).Items
'Loop through all tasks and show subject
Set myItem = oApp.CreateItem(olTaskItem)
'Create a new task
.Subject = "Subject"
.Assign = "Assign"
.Body = "Task Body"
.PercentComplete = 10
'Set due date for tomorrow
.DueDate = DateAdd("d",1,Date)
.ReminderSet = True
.ReminderTime = "9:00 AM"
'Outlook name of person to get task
.Recipients.Add "John Smith"
'Send the task (like email)
Set myItem = Nothing
Set oItm = Nothing
Set oNspc = Nothing
Set oApp = Nothing
Private Sub Form_Load()
'Call out sample sub at form load
Download this snippet
Add to My Saved Code
Add Outlook Tasks Comments
No comments have been posted about Add Outlook Tasks. Why not be the first to post a comment about Add Outlook Tasks.
Post your comment