rz1224
asked on
VBA-generated Outlook task--.remindertime
Hi Experts-- have a function that works great to create Outlook tasks from an Access app. New requirement is to set the start date & reminder time for 2 weeks prior to the 'due date'. Accomplished setting the start date very easily (see below) but I cannot seem to set the reminder time no matter what I try... No errors or anything--just creates the task without checking the reminder box or assigned a reminder time. Any ideas? Thanks.
************************** ********** ********** ********** ********** ****
Function GenTask(strEmail As String, strSubject As String, strDueDate As String, _
strBody As String, strTabQ As String, strID As String)
Dim strStartDate As String
Dim ol As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim itmTask As Outlook.TaskItem
strStartDate = DateAdd("d", -14, strDueDate)
Set ns = ol.GetNamespace("MAPI")
Set itmTask = ol.CreateItem(olTaskItem)
With itmTask
.Assign
.Recipients.Add (strEmail)
.Subject = strSubject
.ReminderSet = True
.ReminderTime = (strStartDate) & " " & CDate(#9:00:00 AM#)
.DueDate = strDueDate
.StartDate = strStartDate
.Body = strBody
.Importance = olImportanceHigh
.Mileage = strTabQ
.BillingInformation = strID
.Save
.Send
End With
End Function
************************** ********** ********** ********** ********** ********** ********** *****
**************************
Function GenTask(strEmail As String, strSubject As String, strDueDate As String, _
strBody As String, strTabQ As String, strID As String)
Dim strStartDate As String
Dim ol As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim itmTask As Outlook.TaskItem
strStartDate = DateAdd("d", -14, strDueDate)
Set ns = ol.GetNamespace("MAPI")
Set itmTask = ol.CreateItem(olTaskItem)
With itmTask
.Assign
.Recipients.Add (strEmail)
.Subject = strSubject
.ReminderSet = True
.ReminderTime = (strStartDate) & " " & CDate(#9:00:00 AM#)
.DueDate = strDueDate
.StartDate = strStartDate
.Body = strBody
.Importance = olImportanceHigh
.Mileage = strTabQ
.BillingInformation = strID
.Save
.Send
End With
End Function
**************************
ASKER
PDB--thanks for the suggestion but is still does not seem to matter. Send out the task just fine but the reminder is still not set...
maybe their default is set to not have a remider for tasks ...
.ReminderOverrideDefault = True
.ReminderOverrideDefault = True
I think you may be executing the commands listed below in wrong sequence in your code. Change to this sequence so that the reminder is set after date and time values are known.
Also, I used the CDate function to convert strings to dates.
.ReminderTime = CDate(strStartDate) & " " & TimeValue("9:00:00 AM")
.DueDate = CDate(strDueDate)
.StartDate = CDate(strStartDate)
.ReminderSet = True
Also, I used the CDate function to convert strings to dates.
.ReminderTime = CDate(strStartDate) & " " & TimeValue("9:00:00 AM")
.DueDate = CDate(strDueDate)
.StartDate = CDate(strStartDate)
.ReminderSet = True
ASKER
Stevbe--I've tried that as well with no luck..
PDB--Still no love! I had wondered if the order was causing a problem, but apparently that's not it....
PDB--Still no love! I had wondered if the order was causing a problem, but apparently that's not it....
1. Missing set statement:
Set ol = CreateObject("Outlook.Appl ication")
2. change reminder time to timeValue only (no date)
.ReminderTime = TimeValue("9:00:00 AM")
3. Put code back in this order:
.ReminderSet = True
.DueDate = CDate(strDueDate)
.ReminderTime = TimeValue("9:00:00 AM")
.StartDate = CDate(strStartDate)
Set ol = CreateObject("Outlook.Appl
2. change reminder time to timeValue only (no date)
.ReminderTime = TimeValue("9:00:00 AM")
3. Put code back in this order:
.ReminderSet = True
.DueDate = CDate(strDueDate)
.ReminderTime = TimeValue("9:00:00 AM")
.StartDate = CDate(strStartDate)
ASKER
PDB.. this is really puzzling. Still does not work. Again--the task is created as it shoud be, but the only thing not appearing correctly is the reminder.
rz,
You aren't kidding! Could it be a problem with your VB library references? According to Microsoft you need to have a reference set to the ms outlook object library. Check and let me know.
PDB
You aren't kidding! Could it be a problem with your VB library references? According to Microsoft you need to have a reference set to the ms outlook object library. Check and let me know.
PDB
Also try with dates and times as strings....remove CDate and TimeValue functions and see what happens.
ASKER
PBD-- The reference is there & all the other dates get populated whether or not I use the CDate function--but not the reminder. I think it must be something with the order of things...Like I said before the tasks ARE being created--the reminder stuff is the only section not being addressed. If you can think of anything else to check let me know--I appreciate your help. I should have some time tomorrow to try to strip it down and see if I can get it to work...
rz,
if you've made the corrections I've given to you, I can't see anything wrong with your code........but check the following:
1. Outlook will not fire reminders in folders other than the default folders.
Are these reminders in your default folders (e.g main tasks folder)?
2. Check Outlook options | other | advanced | reminder options and be sure that you have 'display the reminder' ticked.
PDB
if you've made the corrections I've given to you, I can't see anything wrong with your code........but check the following:
1. Outlook will not fire reminders in folders other than the default folders.
Are these reminders in your default folders (e.g main tasks folder)?
2. Check Outlook options | other | advanced | reminder options and be sure that you have 'display the reminder' ticked.
PDB
just to make sure we are not all goofy ... I build a very simple test ... it works even if I have option of set reminder for tasks with due date turned off. Give it a whirl and let us know.
Steve
Public Function MakeTask()
Dim o As New Outlook.Application
Dim t As Outlook.TaskItem
Set t = o.CreateItem(olTaskItem)
t.Subject = "test"
t.StartDate = Now + 1
t.DueDate = Now + 2
t.ReminderTime = DateAdd("h", 9, t.StartDate)
t.ReminderSet = True
t.Save
End Function
Steve
Public Function MakeTask()
Dim o As New Outlook.Application
Dim t As Outlook.TaskItem
Set t = o.CreateItem(olTaskItem)
t.Subject = "test"
t.StartDate = Now + 1
t.DueDate = Now + 2
t.ReminderTime = DateAdd("h", 9, t.StartDate)
t.ReminderSet = True
t.Save
End Function
ASKER
Guys--Thanks so much for your input. Haven't had an opportunity to get back to this but will do so first thing on Monday. Talk to you then.
ASKER
Sorry for the delay..you know how it goes.... Anyway, I'm back to this now.
PDB--I've tried/checked everything you've listed & I don't know why its still not working...
Steveb-- YOur coded does indeed create a task with the reminder info--why doesn't mine!!?!?!
My code sends out a task to another user from the local account--does that make a difference? I'm gonna try stripping down my code to see if I can make it work but I welcome any suggestions.
Thanks.
PDB--I've tried/checked everything you've listed & I don't know why its still not working...
Steveb-- YOur coded does indeed create a task with the reminder info--why doesn't mine!!?!?!
My code sends out a task to another user from the local account--does that make a difference? I'm gonna try stripping down my code to see if I can make it work but I welcome any suggestions.
Thanks.
ASKER
I've discovered that if I take out the following:
.Assign
.Recipients.Add (strEmail)
.Send
from my code it will create the task on the local machine with the reminder as intended. Is there any reason that the .reminder stuff shouldn't work when a task is being assigned and sent out?
Upped the points for your patience with me....
.Assign
.Recipients.Add (strEmail)
.Send
from my code it will create the task on the local machine with the reminder as intended. Is there any reason that the .reminder stuff shouldn't work when a task is being assigned and sent out?
Upped the points for your patience with me....
rz,
from my previous post:
1. Outlook will not fire reminders in folders other than the default folders.
Are these reminders in your default folders (e.g main tasks folder)?
2. Check Outlook options | other | advanced | reminder options and be sure that you have 'display the reminder' ticked.
PDB
from my previous post:
1. Outlook will not fire reminders in folders other than the default folders.
Are these reminders in your default folders (e.g main tasks folder)?
2. Check Outlook options | other | advanced | reminder options and be sure that you have 'display the reminder' ticked.
PDB
ASKER
PDB--Guess I misunderstood. Assume you mean number 1
"Outlook will not fire reminders in folders other than the default folders"
Since it's being sent to a users inbox(for acceptance) prior to being written to the task folder (on both the 'sending' machine & the 'sent to user' machine) you're saying that the reminder wont be set?
If so--any way around that?
"Outlook will not fire reminders in folders other than the default folders"
Since it's being sent to a users inbox(for acceptance) prior to being written to the task folder (on both the 'sending' machine & the 'sent to user' machine) you're saying that the reminder wont be set?
If so--any way around that?
rz,
yes........see this link.....the symptoms are similar to yours....and there are several work arounds that you can try.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q195964
Hope this helps.
PDB
yes........see this link.....the symptoms are similar to yours....and there are several work arounds that you can try.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q195964
Hope this helps.
PDB
ASKER
Thanks PBD-- I'm guessing I'm kinda sunk on this one. Don't see anything in your link that would really apply to my situation. If you know of any code based work-arounds let me know...
rz,
I think you could get by with a logistical work around. Why can't you create a tentative task and set the reminder before you send to user for acceptance? You could differentiate these "tentative tasks" by the use of a designated importance (priority) used only for tasks pending acceptance. The importance level could be changed when the task is accepted.
I think you could get by with a logistical work around. Why can't you create a tentative task and set the reminder before you send to user for acceptance? You could differentiate these "tentative tasks" by the use of a designated importance (priority) used only for tasks pending acceptance. The importance level could be changed when the task is accepted.
ASKER
I like your thinking but I'm not sure what you mean by 'tentative task'. Aren't I basically saving the task before sending it now? Can you elaborate?
Tentative task is the wrong word..flagged is better.
I understood your statement to say that you couldn't create the task in the folder you receive your email (your default Outlook folder) because the task had to be routed to the user for acceptance (receipt). You also stated that the link (excerpted below) I gave you did not apply to your situation. So my response is that your problem is a logistics problem .....in absence of delivery to your mailbox, you can flag them by raising the importance level (red flag) in lieu of a reminder. Other possible work arounds: Maybe you could have a cc: routed
to you. You could look into a "group" calendar.
To quote the link:
Reminders only trigger from within the primary Calendar or Task folders. Primary folders reside where you receive messages. When you set up an e-mail service, you designate either your mailbox Inbox or your personal folders (.pst) file Inbox as the mail delivery point. For example, if you receive messages in your personal folders (.pst) file Inbox and you create an appointment reminder in your mailbox Calendar, the reminder does not appear. If you create the same reminder in your Personal Folders Calendar, the reminder does appear at the appropriate time.
ASKER
PBD--Rest assured the points are yours regardless & I appreciate your attempting to help me with this one, but I'm still a bit confused... In a nutshell my app:
1--runs on a dedicated machine w/ dedicated 'mailer daemon' outlook account.
2--when necessary, tasks are assigned and sent out from this instance of Outlook
3--tasks are then accepted by individual users and any changes are synchronized back with 'mailer daemon' account's copy for nightly batch extraction to db for updates w/ app
I guess these tasks don't 'exist' until accepted? I appreciate the 'flag' workaround but if there is no way for me to assign reminders to these users once they accept the task then I'm probably better off doing nothing at all. What's most important here is that I keep an updated 'copy' of the task on this local 'mailer daemon' machine for download & update into the app. How it gets assigned/given to the user is secondary so long as I can track what their progress on the task once they begin work... Any way I can get reminders to populate for their tasks?....
Thanks so much for your time.
1--runs on a dedicated machine w/ dedicated 'mailer daemon' outlook account.
2--when necessary, tasks are assigned and sent out from this instance of Outlook
3--tasks are then accepted by individual users and any changes are synchronized back with 'mailer daemon' account's copy for nightly batch extraction to db for updates w/ app
I guess these tasks don't 'exist' until accepted? I appreciate the 'flag' workaround but if there is no way for me to assign reminders to these users once they accept the task then I'm probably better off doing nothing at all. What's most important here is that I keep an updated 'copy' of the task on this local 'mailer daemon' machine for download & update into the app. How it gets assigned/given to the user is secondary so long as I can track what their progress on the task once they begin work... Any way I can get reminders to populate for their tasks?....
Thanks so much for your time.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks.
ASKER
Sorry 'bout the delay... slipped my mind.
I had a similar experiece. So, I wondered if the default .remindertime was overriding my coded update at the time of .save. I used .save to create the task, then updated the .remindertime and saved again. It worked.
.Save
.ReminderTime = DateValue(#8/31/2010#) & " " & TimeValue(#11:41:00 AM#)
.Save
.Save
.ReminderTime = DateValue(#8/31/2010#) & " " & TimeValue(#11:41:00 AM#)
.Save
.ReminderTime = (strStartDate) & " " & CDate(#9:00:00 AM#)
to:
.ReminderTime = CDate(strStartDate) & " " & TimeValue("9:00:00 AM")