 |
|
|
|
| Author |
Message |
Adrian
Joined: 12 Aug 2007 Posts: 5
|
Posted: Thu Feb 21, 2008 11:31 pm Post subject: Turn off reminders programatically |
|
|
Outlook 2007 SP1/Exchange 2007
I want to programmatically turn off reminders for all 'all day' events that
I receive. Can anyone give me some guidance of how I might do this. I have
some experience of using VBA, but none with Outlook.
Thanks for any help.
Adrian
Archived from group: microsoft>public>outlook>program_vba |
|
| Back to top |
|
 |
Eric Legault [MVP - Outlo
Joined: 12 Aug 2007 Posts: 60
|
Posted: Thu Feb 21, 2008 5:06 pm Post subject: RE: Turn off reminders programatically |
|
|
There's 2 ways to do this:
1) Use a rule to run a script (How to create a script for the Rules Wizard
in Outlook:
http://support.microsoft.com/default.aspx?scid=KB;en-us;q306108). When your
function fires, you'll have to call
NameSpace.GetDefaultFolder(olFolderCalendar) to get a MAPIFolder object.
Then use Find or Restrict with MAPIFolder.Items to look for the Appointment
Item that was created in the Calendar as soon as the message was delivered to
your Inbox. You'll probably have to compare not only the Subject properties,
but also Start and End to guarantee you get the correct event. Once you have
the AppointmentItem object, set ReminderSet to False and Save.
2) Instead of a rule, monitor the ItemAdd event for your Calendar. You can
do this by grapping the Items collection object for the Calendar during
Application_Startup, and use a module level var for Items that uses the
WithEvents keyword so you can trap the event. When the event fires, you can
clear ReminderSet for all new appointments, or just for ones that have not
been accepted or rejected.
Let me know if you have any questions.
--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
"Adrian" wrote:
> Outlook 2007 SP1/Exchange 2007
>
> I want to programmatically turn off reminders for all 'all day' events that
> I receive. Can anyone give me some guidance of how I might do this. I have
> some experience of using VBA, but none with Outlook.
>
> Thanks for any help.
>
> Adrian
>
>
> |
|
| Back to top |
|
 |
Michael Bauer [MVP - Outl
Joined: 12 Aug 2007 Posts: 92
|
Posted: Fri Feb 22, 2008 11:38 am Post subject: Re: Turn off reminders programatically |
|
|
Here's a sample for the ItemAdd approach:
http://www.vboffice.net/sample.html?mnu=2&pub=6&smp=58&cmd=showitem&lang=en
--
Best regards
Michael Bauer - MVP Outlook
Use Outlook Categories? This is Your Tool:
Am Thu, 21 Feb 2008 18:31:16 -0000 schrieb Adrian:
> Outlook 2007 SP1/Exchange 2007
>
> I want to programmatically turn off reminders for all 'all day' events
that
> I receive. Can anyone give me some guidance of how I might do this. I have
> some experience of using VBA, but none with Outlook.
>
> Thanks for any help.
>
> Adrian |
|
| Back to top |
|
 |
Adrian
Joined: 12 Aug 2007 Posts: 5
|
Posted: Fri Feb 22, 2008 2:28 pm Post subject: Re: Turn off reminders programatically |
|
|
Thanks for your suggestions.
I will have a look at this and let you know how I get on.
Adrian
"Michael Bauer [MVP - Outlook]" wrote in message $.dlg@40tude.net...
>
>
> Here's a sample for the ItemAdd approach:
> http://www.vboffice.net/sample.html?mnu=2&pub=6&smp=58&cmd=showitem&lang=en
>
> --
> Best regards
> Michael Bauer - MVP Outlook
> Use Outlook Categories? This is Your Tool:
>
>
>
> Am Thu, 21 Feb 2008 18:31:16 -0000 schrieb Adrian:
>
>> Outlook 2007 SP1/Exchange 2007
>>
>> I want to programmatically turn off reminders for all 'all day' events
> that
>> I receive. Can anyone give me some guidance of how I might do this. I
>> have
>> some experience of using VBA, but none with Outlook.
>>
>> Thanks for any help.
>>
>> Adrian |
|
| Back to top |
|
 |
Adrian
Joined: 12 Aug 2007 Posts: 5
|
Posted: Sat Feb 23, 2008 5:56 pm Post subject: Re: Turn off reminders programatically |
|
|
Michael,
I just pasted your example code into 'This OutlookSession' but nothing seems
to happen. What have I done wrong?
Thanks again for your help.
Adrian.
"Michael Bauer [MVP - Outlook]" wrote in message $.dlg@40tude.net...
>
>
> Here's a sample for the ItemAdd approach:
> http://www.vboffice.net/sample.html?mnu=2&pub=6&smp=58&cmd=showitem&lang=en
>
> --
> Best regards
> Michael Bauer - MVP Outlook
> Use Outlook Categories? This is Your Tool:
>
>
>
> Am Thu, 21 Feb 2008 18:31:16 -0000 schrieb Adrian:
>
>> Outlook 2007 SP1/Exchange 2007
>>
>> I want to programmatically turn off reminders for all 'all day' events
> that
>> I receive. Can anyone give me some guidance of how I might do this. I
>> have
>> some experience of using VBA, but none with Outlook.
>>
>> Thanks for any help.
>>
>> Adrian |
|
| Back to top |
|
 |
Michael Bauer [MVP - Outl
Joined: 12 Aug 2007 Posts: 92
|
Posted: Mon Feb 25, 2008 12:20 pm Post subject: Re: Turn off reminders programatically |
|
|
After any changes you need to call the Application_Startup procedure. That's
automatically done when you restart Outlook. Additionally, set the security
settings (Tools/Macro/Security) so that VBA is executed at all.
--
Best regards
Michael Bauer - MVP Outlook
Use Outlook Categories? This is Your Tool:
Am Sat, 23 Feb 2008 12:56:59 -0000 schrieb Adrian:
> Michael,
>
> I just pasted your example code into 'This OutlookSession' but nothing
seems
> to happen. What have I done wrong?
>
> Thanks again for your help.
>
> Adrian.
>
>
> "Michael Bauer [MVP - Outlook]" wrote in message
> $.dlg@40tude.net...
>>
>>
>> Here's a sample for the ItemAdd approach:
>>
http://www.vboffice.net/sample.html?mnu=2&pub=6&smp=58&cmd=showitem&lang=en
>>
>> --
>> Best regards
>> Michael Bauer - MVP Outlook
>> Use Outlook Categories? This is Your Tool:
>>
>>
>>
>> Am Thu, 21 Feb 2008 18:31:16 -0000 schrieb Adrian:
>>
>>> Outlook 2007 SP1/Exchange 2007
>>>
>>> I want to programmatically turn off reminders for all 'all day' events
>> that
>>> I receive. Can anyone give me some guidance of how I might do this. I
>>> have
>>> some experience of using VBA, but none with Outlook.
>>>
>>> Thanks for any help.
>>>
>>> Adrian |
|
| Back to top |
|
 |
Adrian
Joined: 12 Aug 2007 Posts: 5
|
Posted: Tue Feb 26, 2008 12:59 am Post subject: Re: Turn off reminders programatically |
|
|
Michael,
Thanks for your advice. Below is the code I have. It is running the
Application_Startup but never runs Items_ItemAdd. Any ideas?
++++++++++++++++++++++++++++
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
Set Items = Ns.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
On Error Resume Next
Dim Meet As Outlook.MeetingItem
Dim Appt As Outlook.AppointmentItem
If TypeOf Item Is Outlook.MeetingItem Then
Set Meet = Item
Meet.ReminderSet = False
Meet.Save
Set Appt = Meet.GetAssociatedAppointment(True)
If Not Appt Is Nothing Then
Appt.ReminderSet = False
Appt.Save
End If
End If
End Sub
++++++++++++++++++++++++++++
Thanks,
Adrian
"Michael Bauer [MVP - Outlook]" wrote in message $.50v5x8sfm6ge$.dlg@40tude.net...
>
>
> After any changes you need to call the Application_Startup procedure.
> That's
> automatically done when you restart Outlook. Additionally, set the
> security
> settings (Tools/Macro/Security) so that VBA is executed at all.
>
> --
> Best regards
> Michael Bauer - MVP Outlook
> Use Outlook Categories? This is Your Tool:
>
>
>
> Am Sat, 23 Feb 2008 12:56:59 -0000 schrieb Adrian:
>
>> Michael,
>>
>> I just pasted your example code into 'This OutlookSession' but nothing
> seems
>> to happen. What have I done wrong?
>>
>> Thanks again for your help.
>>
>> Adrian.
>>
>>
>> "Michael Bauer [MVP - Outlook]" wrote in message
>> $.dlg@40tude.net...
>>>
>>>
>>> Here's a sample for the ItemAdd approach:
>>>
> http://www.vboffice.net/sample.html?mnu=2&pub=6&smp=58&cmd=showitem&lang=en
>>>
>>> --
>>> Best regards
>>> Michael Bauer - MVP Outlook
>>> Use Outlook Categories? This is Your Tool:
>>>
>>>
>
>>>
>>> Am Thu, 21 Feb 2008 18:31:16 -0000 schrieb Adrian:
>>>
>>>> Outlook 2007 SP1/Exchange 2007
>>>>
>>>> I want to programmatically turn off reminders for all 'all day' events
>>> that
>>>> I receive. Can anyone give me some guidance of how I might do this. I
>>>> have
>>>> some experience of using VBA, but none with Outlook.
>>>>
>>>> Thanks for any help.
>>>>
>>>> Adrian |
|
| Back to top |
|
 |
Michael Bauer [MVP - Outl
Joined: 12 Aug 2007 Posts: 92
|
Posted: Tue Feb 26, 2008 11:40 am Post subject: Re: Turn off reminders programatically |
|
|
Where do you know from that ItemAdd is not running? If you did not do that
already, set a breakpoint on the Private Sub Items_ItemAdd line (f9). Then
receive a MeetingItem into your Inbox, the code execution should stop at the
breakpoint. you can then walk trough it with f8 step by step and watch what
happens.
ItemAdd fires only if Outlook is running while items come in and if it's not
more than 16 items at once.
--
Best regards
Michael Bauer - MVP Outlook
Use Outlook Categories? This is Your Tool:
Am Mon, 25 Feb 2008 19:59:29 -0000 schrieb Adrian:
> Michael,
>
> Thanks for your advice. Below is the code I have. It is running the
> Application_Startup but never runs Items_ItemAdd. Any ideas?
>
> ++++++++++++++++++++++++++++
> Private WithEvents Items As Outlook.Items
>
> Private Sub Application_Startup()
> Dim Ns As Outlook.NameSpace
>
> Set Ns = Application.GetNamespace("MAPI")
> Set Items = Ns.GetDefaultFolder(olFolderInbox).Items
> End Sub
>
> Private Sub Items_ItemAdd(ByVal Item As Object)
> On Error Resume Next
> Dim Meet As Outlook.MeetingItem
> Dim Appt As Outlook.AppointmentItem
>
> If TypeOf Item Is Outlook.MeetingItem Then
> Set Meet = Item
>
> Meet.ReminderSet = False
> Meet.Save
>
>
> Set Appt = Meet.GetAssociatedAppointment(True)
>
> If Not Appt Is Nothing Then
> Appt.ReminderSet = False
> Appt.Save
> End If
> End If
> End Sub
>
> ++++++++++++++++++++++++++++
> Thanks,
>
> Adrian
> "Michael Bauer [MVP - Outlook]" wrote in message
> $.50v5x8sfm6ge$.dlg@40tude.net...
>>
>>
>> After any changes you need to call the Application_Startup procedure.
>> That's
>> automatically done when you restart Outlook. Additionally, set the
>> security
>> settings (Tools/Macro/Security) so that VBA is executed at all.
>>
>> --
>> Best regards
>> Michael Bauer - MVP Outlook
>> Use Outlook Categories? This is Your Tool:
>>
>>
>>
>> Am Sat, 23 Feb 2008 12:56:59 -0000 schrieb Adrian:
>>
>>> Michael,
>>>
>>> I just pasted your example code into 'This OutlookSession' but nothing
>> seems
>>> to happen. What have I done wrong?
>>>
>>> Thanks again for your help.
>>>
>>> Adrian.
>>>
>>>
>>> "Michael Bauer [MVP - Outlook]" wrote in message
>>> $.dlg@40tude.net...
>>>>
>>>>
>>>> Here's a sample for the ItemAdd approach:
>>>>
>>
http://www.vboffice.net/sample.html?mnu=2&pub=6&smp=58&cmd=showitem&lang=en
>>>>
>>>> --
>>>> Best regards
>>>> Michael Bauer - MVP Outlook
>>>> Use Outlook Categories? This is Your Tool:
>>>>
>>>>
>>
>>>>
>>>> Am Thu, 21 Feb 2008 18:31:16 -0000 schrieb Adrian:
>>>>
>>>>> Outlook 2007 SP1/Exchange 2007
>>>>>
>>>>> I want to programmatically turn off reminders for all 'all day' events
>>>> that
>>>>> I receive. Can anyone give me some guidance of how I might do this. I
>>>>> have
>>>>> some experience of using VBA, but none with Outlook.
>>>>>
>>>>> Thanks for any help.
>>>>>
>>>>> Adrian |
|
| Back to top |
|
 |
Adrian
Joined: 12 Aug 2007 Posts: 5
|
Posted: Wed Feb 27, 2008 1:27 am Post subject: Re: Turn off reminders programatically |
|
|
Michael,
Thank you for your patience. It is now working.
Although I had tested it with items coming in, I suspect that was before I
changed the security. For some reason I thought it ran when Outlook opened,
and I had been testing that.
Just one quick final question please. I wanted to only turn off reminders
for all day events so I tried 'If Appt.AllDayEvent = True Then...', but
Appt.AllDayEvent seems to remain False for All Day Events. Why is that? I
have worked around this by testing if Appt.Duration = 1440 and this seems to
work.
Thanks again.
Adrian
If I receive an All Day Appointment
"Michael Bauer [MVP - Outlook]" wrote in message @40tude.net...
>
>
> Where do you know from that ItemAdd is not running? If you did not do that
> already, set a breakpoint on the Private Sub Items_ItemAdd line (f9). Then
> receive a MeetingItem into your Inbox, the code execution should stop at
> the
> breakpoint. you can then walk trough it with f8 step by step and watch
> what
> happens.
>
> ItemAdd fires only if Outlook is running while items come in and if it's
> not
> more than 16 items at once.
>
> --
> Best regards
> Michael Bauer - MVP Outlook
> Use Outlook Categories? This is Your Tool:
>
>
>
> Am Mon, 25 Feb 2008 19:59:29 -0000 schrieb Adrian:
>
>> Michael,
>>
>> Thanks for your advice. Below is the code I have. It is running the
>> Application_Startup but never runs Items_ItemAdd. Any ideas?
>>
>> ++++++++++++++++++++++++++++
>> Private WithEvents Items As Outlook.Items
>>
>> Private Sub Application_Startup()
>> Dim Ns As Outlook.NameSpace
>>
>> Set Ns = Application.GetNamespace("MAPI")
>> Set Items = Ns.GetDefaultFolder(olFolderInbox).Items
>> End Sub
>>
>> Private Sub Items_ItemAdd(ByVal Item As Object)
>> On Error Resume Next
>> Dim Meet As Outlook.MeetingItem
>> Dim Appt As Outlook.AppointmentItem
>>
>> If TypeOf Item Is Outlook.MeetingItem Then
>> Set Meet = Item
>>
>> Meet.ReminderSet = False
>> Meet.Save
>>
>>
>> Set Appt = Meet.GetAssociatedAppointment(True)
>>
>> If Not Appt Is Nothing Then
>> Appt.ReminderSet = False
>> Appt.Save
>> End If
>> End If
>> End Sub
>>
>> ++++++++++++++++++++++++++++
>> Thanks,
>>
>> Adrian
>> "Michael Bauer [MVP - Outlook]" wrote in message
>> $.50v5x8sfm6ge$.dlg@40tude.net...
>>>
>>>
>>> After any changes you need to call the Application_Startup procedure.
>>> That's
>>> automatically done when you restart Outlook. Additionally, set the
>>> security
>>> settings (Tools/Macro/Security) so that VBA is executed at all.
>>>
>>> --
>>> Best regards
>>> Michael Bauer - MVP Outlook
>>> Use Outlook Categories? This is Your Tool:
>>>
>>>
>
>>>
>>> Am Sat, 23 Feb 2008 12:56:59 -0000 schrieb Adrian:
>>>
>>>> Michael,
>>>>
>>>> I just pasted your example code into 'This OutlookSession' but nothing
>>> seems
>>>> to happen. What have I done wrong?
>>>>
>>>> Thanks again for your help.
>>>>
>>>> Adrian.
>>>>
>>>>
>>>> "Michael Bauer [MVP - Outlook]" wrote in message
>>>> $.dlg@40tude.net...
>>>>>
>>>>>
>>>>> Here's a sample for the ItemAdd approach:
>>>>>
>>>
> http://www.vboffice.net/sample.html?mnu=2&pub=6&smp=58&cmd=showitem&lang=en
>>>>>
>>>>> --
>>>>> Best regards
>>>>> Michael Bauer - MVP Outlook
>>>>> Use Outlook Categories? This is Your Tool:
>>>>>
>>>>>
>>>
>
>>>>>
>>>>> Am Thu, 21 Feb 2008 18:31:16 -0000 schrieb Adrian:
>>>>>
>>>>>> Outlook 2007 SP1/Exchange 2007
>>>>>>
>>>>>> I want to programmatically turn off reminders for all 'all day'
>>>>>> events
>>>>> that
>>>>>> I receive. Can anyone give me some guidance of how I might do this. I
>>>>>> have
>>>>>> some experience of using VBA, but none with Outlook.
>>>>>>
>>>>>> Thanks for any help.
>>>>>>
>>>>>> Adrian
|
|
| Back to top |
|
 |
|
|
| Related Topics: | close reminder window programatically Hi All, I cannot find the way that close reminder window I found dismiss method here. But I cannot find close method... basically, I want these, 1> call sql query at once reminder fir
How do I remove a published form programatically? I have a published form that I have distributed to several users and they have published it in there 'Personal Forms Library'. I am needing to remove this form from the 'Personal Forms Library' with a script file so that I can publish another form with th
Exchange/Outlook-Synchronization programatically hi, i use Exchange 2003 and Outlook 2003. I'm developing an application in VB.NET. My question: When i insert data in a taskform in Outlook 2003, they aren't immediately in the But I need the data in my
Detect completion of Outlook Send/Recieve programatically (v How can I detect when the Outlook Send and Receive process is completed using VBScript or VB? Basically I have a program that needs to wait until the Outlook profile is completely synchronized before I can run a part of my code. Any idea how to detect tha
Custom form not saving when fields changed programatically Is there a way to force a form as "dirty" so Outlook attempts to save it if someone clicks the 'X'? I am changing the HTMLBody and even a custom field but the if I click the 'X' then the form closes without saving. If I change any field using the GUI then |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|