Need help on Reminder code in Automating Outlook Task

S

Sunflower

Not sure if this is the right group to post to....



I have the following code behind a button on a form:
-----------------------------------

Private Sub cmdSend_Click()
Dim NowDate As Date
Dim DateEnd As Date
Dim DateDif As Long
Dim Task As Object
Dim ToContact As Object

Set Task = Outlook.CreateItem(olTaskItem)
NowDate = Now()
DateEnd = DateDue.Value

If DateAdd("d", -1, DateEnd) >= 1 Then
DateEnd = DateAdd("d", -1, DateEnd)
Else
End If

Task.Subject = "WO#" & Me.[WOID] & " - " & Me.[ProjectName].Value
Task.Body = Me.[Comment].Value
Task.Assign
Task.DueDate = DateEnd
Task.ReminderSet = True
Task.ReminderTime = DateAdd("ww", -1, DateEnd)

Task.Importance = (olImportanceHigh)

Task.Save

End Sub
---------------------------------------

I cant seem to get the REMINDER DATE to show up!

Not sure what I have missed!

Any and all help greatly appreciated
 
P

Peter Hibbs

Sunflower,

Not sure what you mean about the reminder date not showing up but try
this and see if it helps :-

Private Sub cmdSend_Click()

Dim NowDate As Date
Dim DateEnd As Date
Dim DateDif As Long
Dim Task As Object
Dim ToContact As Object

Dim OLF As Outlook.MAPIFolder

Set OLF = GetObject("", "Outlook.Application"). _
GetNamespace("MAPI").GetDefaultFolder(olFolderTasks)
Set Task = OLF.Items.Add

NowDate = Now
DateEnd = DateDue

If DateAdd("d", -1, DateEnd) >= 1 Then
DateEnd = DateAdd("d", -1, DateEnd)
End If

Task.Subject = "WO#" & Me.WOID & " - " & Me.ProjectName
Task.Body = Me.Comment
Task.Assign
Task.DueDate = DateEnd
Task.ReminderSet = True
Task.ReminderTime = DateAdd("ww", -1, DateEnd)

Task.Importance = (olImportanceHigh)

Task.Save
Set Task = Nothing
Set OLF = Nothing

End Sub

Peter Hibbs.
 
S

Sunflower

Sunflower,

Not sure what you mean about the reminder date not showing up but try
this and see if it helps :-

Private Sub cmdSend_Click()

Dim NowDate As Date
Dim DateEnd As Date
Dim DateDif As Long
Dim Task As Object
Dim ToContact As Object

Dim OLF As Outlook.MAPIFolder

    Set OLF = GetObject("", "Outlook.Application"). _
    GetNamespace("MAPI").GetDefaultFolder(olFolderTasks)
    Set Task = OLF.Items.Add

    NowDate = Now
    DateEnd = DateDue

    If DateAdd("d", -1, DateEnd) >= 1 Then
        DateEnd = DateAdd("d", -1, DateEnd)
    End If

    Task.Subject = "WO#" & Me.WOID & " - " & Me.ProjectName
    Task.Body = Me.Comment
    Task.Assign
    Task.DueDate = DateEnd
    Task.ReminderSet = True
    Task.ReminderTime = DateAdd("ww", -1, DateEnd)

    Task.Importance = (olImportanceHigh)

    Task.Save
    Set Task = Nothing
    Set OLF = Nothing

End Sub

Peter Hibbs.

Not sure if this is the right group to post to....
I have the following code behind a button on a form:
-----------------------------------
Private Sub cmdSend_Click()
Dim NowDate As Date
Dim DateEnd As Date
Dim DateDif As Long
Dim Task As Object
Dim ToContact As Object
Set Task = Outlook.CreateItem(olTaskItem)
NowDate = Now()
DateEnd = DateDue.Value
If DateAdd("d", -1, DateEnd) >= 1 Then
DateEnd = DateAdd("d", -1, DateEnd)
Else
End If
Task.Subject = "WO#" & Me.[WOID] & " - " & Me.[ProjectName].Value
Task.Body = Me.[Comment].Value
Task.Assign
Task.DueDate = DateEnd
Task.ReminderSet = True
Task.ReminderTime = DateAdd("ww", -1, DateEnd)
Task.Importance = (olImportanceHigh)

End Sub
---------------------------------------
I cant seem to get the REMINDER DATE to show up!
Not sure what I have missed!
Any and all help greatly appreciated- Hide quoted text -

- Show quoted text -

I tried your new code..and
I got the same exact response as my old code...
The task goes into my outlook, but there is no reference of a Reminder
no checkbox, no date of reminder, the whole Reminder line is missing
 
P

Peter Hibbs

Sunflower,

I tried your original code and it seemed to work in that it created a
new task and a reminder form popped up when I entered a valid date but
it only seemed to work if Outlook was running.

The code I posted (which I found with Google) does the same thing but
will work whether Outlook is running or not and I thought that might
be your problem.

However, having looked at it again I see what you mean. Creating a
task manually in Outlook shows a tick box, date field, etc but a task
created in code does not seem to have those controls. Mind you, the
whole task form looks pretty different so I am guessing there is
something else that needs to be done to show it like a 'normal' task
form.

I don't know the answer so I would suggest you post the same question
to the Outlook group (if you haven't already), I am sure they will
have an answer.

Peter Hibbs.

Sunflower,

Not sure what you mean about the reminder date not showing up but try
this and see if it helps :-

Private Sub cmdSend_Click()

Dim NowDate As Date
Dim DateEnd As Date
Dim DateDif As Long
Dim Task As Object
Dim ToContact As Object

Dim OLF As Outlook.MAPIFolder

    Set OLF = GetObject("", "Outlook.Application"). _
    GetNamespace("MAPI").GetDefaultFolder(olFolderTasks)
    Set Task = OLF.Items.Add

    NowDate = Now
    DateEnd = DateDue

    If DateAdd("d", -1, DateEnd) >= 1 Then
        DateEnd = DateAdd("d", -1, DateEnd)
    End If

    Task.Subject = "WO#" & Me.WOID & " - " & Me.ProjectName
    Task.Body = Me.Comment
    Task.Assign
    Task.DueDate = DateEnd
    Task.ReminderSet = True
    Task.ReminderTime = DateAdd("ww", -1, DateEnd)

    Task.Importance = (olImportanceHigh)

    Task.Save
    Set Task = Nothing
    Set OLF = Nothing

End Sub

Peter Hibbs.

Not sure if this is the right group to post to....
I have the following code behind a button on a form:
-----------------------------------
Private Sub cmdSend_Click()
Dim NowDate As Date
Dim DateEnd As Date
Dim DateDif As Long
Dim Task As Object
Dim ToContact As Object
Set Task = Outlook.CreateItem(olTaskItem)
NowDate = Now()
DateEnd = DateDue.Value
If DateAdd("d", -1, DateEnd) >= 1 Then
DateEnd = DateAdd("d", -1, DateEnd)
Else
End If
Task.Subject = "WO#" & Me.[WOID] & " - " & Me.[ProjectName].Value
Task.Body = Me.[Comment].Value
Task.Assign
Task.DueDate = DateEnd
Task.ReminderSet = True
Task.ReminderTime = DateAdd("ww", -1, DateEnd)
Task.Importance = (olImportanceHigh)

End Sub
---------------------------------------
I cant seem to get the REMINDER DATE to show up!
Not sure what I have missed!
Any and all help greatly appreciated- Hide quoted text -

- Show quoted text -

I tried your new code..and
I got the same exact response as my old code...
The task goes into my outlook, but there is no reference of a Reminder
no checkbox, no date of reminder, the whole Reminder line is missing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top