Storyteller
Instructor
Hello All,
I am using this code to create a new task that appears in the users task folder. However, I would like it to be created in a Public Folder "Common Tasks". Any suggestions?
Public Sub CreateTask()
Dim outObj As Outlook.Application
Dim outTask As Outlook.TaskItem
Dim objFolder As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Set outObj = CreateObject("outlook.application")
Set objNS = outObj.GetNamespace("MAPI")
Set objFolder = objNS.Folders.Item("Public Folders"). _
Folders.Item("All Public Folders"). _
Folders.Item("Common Tasks")
Set outTask = outObj.CreateItem(olTaskItem)
With outTask
.Subject = "Remember to call " & Forms!frmEmailSendingTest.FirstName _
& " " & Forms!frmEmailSendingTest.LastName
.DueDate = Date + 1
.ReminderSet = True
.Body = "Phone number is: " & Forms!frmEmailSendingTest.Phone
.Owner = GetMailboxUserName
.Display
End With
Set outObj = Nothing
Set outTask = Nothing
End Sub
Thanks for all your help.
Regards,
Michael
I am using this code to create a new task that appears in the users task folder. However, I would like it to be created in a Public Folder "Common Tasks". Any suggestions?
Public Sub CreateTask()
Dim outObj As Outlook.Application
Dim outTask As Outlook.TaskItem
Dim objFolder As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Set outObj = CreateObject("outlook.application")
Set objNS = outObj.GetNamespace("MAPI")
Set objFolder = objNS.Folders.Item("Public Folders"). _
Folders.Item("All Public Folders"). _
Folders.Item("Common Tasks")
Set outTask = outObj.CreateItem(olTaskItem)
With outTask
.Subject = "Remember to call " & Forms!frmEmailSendingTest.FirstName _
& " " & Forms!frmEmailSendingTest.LastName
.DueDate = Date + 1
.ReminderSet = True
.Body = "Phone number is: " & Forms!frmEmailSendingTest.Phone
.Owner = GetMailboxUserName
.Display
End With
Set outObj = Nothing
Set outTask = Nothing
End Sub
Thanks for all your help.
Regards,
Michael