Outlook Task Error

gsrajan

Registered User.
Local time
Today, 06:28
Joined
Apr 22, 2014
Messages
227
Please help me, I am getting this error for the following code:

Run time error: 91;
Object variable or with block variable not set

Thank you.
**************************************

Private Sub SendTask()
Dim outlookApp As Outlook.Application
Dim outlookTask As Outlook.TaskItem

Set outloopApp = CreateObject("Outlook.application")
Set outlookTask = outlookApp.CreateItem(olTaskItem) ' here is the error message.



With outlookTask
.Subject = "Reminder for Task ID: " & Me.txtTicketID
.Body = "This is a reminder from your Task List with the due date: " & txtDueDte
.ReminderSet = True
.DUEDATE = Me.txtDueDte
.ReminderTime = Me.txtDueDate - 1 & " 9.30 A.M."
.Save
End With

MsgBox "Task has been set in Outlook sucessfully.", vbInformation, "Set Task Confirmed"
End Sub
 
Last edited:
did you set reference (on vba, tools->reference) to Microsoft Outlook XX.X Object Library?
 
Please help me, I am getting this error for the following code:

Run time error: 91;
Object variable or with block variable not set

Thank you.
**************************************

Private Sub SendTask()
Dim outlookApp As Outlook.Application
Dim outlookTask As Outlook.TaskItem

Set outloopApp = CreateObject("Outlook.application")
Set outlookTask = outlookApp.CreateItem(olTaskItem)



With outlookTask
.Subject = "Reminder for Task ID: " & Me.txtTicketID
.Body = "This is a reminder from your Task List with the due date: " & txtDueDte
.ReminderSet = True
.DUEDATE = Me.txtDueDte
.ReminderTime = Me.txtDueDate - 1 & " 9.30 A.M."
.Save
End With

MsgBox "Task has been set in Outlook sucessfully.", vbInformation, "Set Task Confirmed"
End Sub
You need to compile your code? See the above quoted.
 
is this typo:

Set outloopApp=...
 

Users who are viewing this thread

Back
Top Bottom