Handling run-time error 94

GMU

New member
Local time
Today, 20:15
Joined
Oct 26, 2014
Messages
3
Hello community
I am working on a vba code ( i am not a vba specialist) to set a task in outlook, i have only 2 fields a textbox and a calendar-box, assuming that I hit OK and I forgot an empty field I got a run-time error 94 related to .DueDate, can someone fix this? Or improve the code with the handling error code? I need this also to prevent that Users access Debug. This is the code and Thank you so much for the help:


Private Sub Command10_Click()

Dim OutlookApp As OutLook.Application
Dim outLookTask As OutLook.TaskItem

Set OutlookApp = CreateObject("outlook.application")
Set outLookTask = OutlookApp.CreateItem(olTaskItem)

With outLookTask
.Subject = "Reminder for Task: " & Me.TaskName
.Body = "This is a Task-Reminder from RinkuFM. Task name: " & Me.TaskName & " is due on " & Me.DueDate
.ReminderSet = True
.DueDate = Me.DueDate ' here i got the error
.ReminderTime = Me.DueDate - 7 & " 9:00 AM"
.Save
End With

MsgBox " Task has been set in Outlook successfully. You will be noticed in 7 days at 9:00 AM!", vbInformation, "Set Task Confirm"
End

End Sub
 
I solved the problem thanks an early post by "pbaldy"
 

Users who are viewing this thread

Back
Top Bottom