Outlook Task Error (1 Viewer)

gsrajan

Registered User.
Local time
Today, 12:41
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:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:41
Joined
May 7, 2009
Messages
19,248
did you set reference (on vba, tools->reference) to Microsoft Outlook XX.X Object Library?
 

Gasman

Enthusiastic Amateur
Local time
Today, 17:41
Joined
Sep 21, 2011
Messages
14,323
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:41
Joined
May 7, 2009
Messages
19,248
is this typo:

Set outloopApp=...
 

Users who are viewing this thread

Top Bottom