E
Ed
When I run this code it seems to run ok but when I check the task in my task
folder it says "This message not sent".
But it does get sent.
If I add .Display after .Body I get an error message that says "You must be
in a public folder to change the owner field of a task...."
Private Sub addNewTask()
Dim myOlApp As Outlook.Application
Dim myItem As TaskItem
Dim objSafeMsg As Redemption.SafeTaskItem
On Error GoTo ErrHandler
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olTaskItem)
Set objSafeMsg = CreateObject("Redemption.SafeTaskItem")
With myItem
.Assign
.Subject = Me!Subject
.Owner = Me!Owner
.Body = Me!Body
End With
objSafeMsg.Item = myItem
objSafeMsg.Recipients.Add Me!cmbRecipients.Column(1)
Debug.Print objSafeMsg.Owner
objSafeMsg.Recipients.ResolveAll
objSafeMsg.Send
ExitHandler:
Set myItem = Nothing
Set myOlApp = Nothing
Exit Sub
ErrHandler:
MsgBox Err, , Err.Description
GoTo ExitHandler
End Sub
folder it says "This message not sent".
But it does get sent.
If I add .Display after .Body I get an error message that says "You must be
in a public folder to change the owner field of a task...."
Private Sub addNewTask()
Dim myOlApp As Outlook.Application
Dim myItem As TaskItem
Dim objSafeMsg As Redemption.SafeTaskItem
On Error GoTo ErrHandler
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olTaskItem)
Set objSafeMsg = CreateObject("Redemption.SafeTaskItem")
With myItem
.Assign
.Subject = Me!Subject
.Owner = Me!Owner
.Body = Me!Body
End With
objSafeMsg.Item = myItem
objSafeMsg.Recipients.Add Me!cmbRecipients.Column(1)
Debug.Print objSafeMsg.Owner
objSafeMsg.Recipients.ResolveAll
objSafeMsg.Send
ExitHandler:
Set myItem = Nothing
Set myOlApp = Nothing
Exit Sub
ErrHandler:
MsgBox Err, , Err.Description
GoTo ExitHandler
End Sub