A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to detect flag event from vba?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 13th 07, 11:37 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 10
Default How to detect flag event from vba?

I want to move a message to a specified folder once its flagged. How
can I detect that flagging event from vba?
Ads
  #2  
Old December 13th 07, 04:13 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to detect flag event from vba?

You'd have to handle the ItemChange event of the Items collection and check
to see what was changed. An alternative would be to instantiate event
handlers for any selected or open item and handle the item.PropertyChange
event but that wouldn't get you items flagged from the context menu since
those might not be selected.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
...
I want to move a message to a specified folder once its flagged. How
can I detect that flagging event from vba?


  #3  
Old December 17th 07, 07:37 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 10
Default How to detect flag event from vba?

I dont see any itemchange event in thisoutlooksession. Can you
explain with example?

On Dec 13, 8:13 pm, "Ken Slovak - [MVP - Outlook]"
wrote:
You'd have to handle the ItemChange event of the Items collection and check
to see what was changed. An alternative would be to instantiate event
handlers for any selected or open item and handle the item.PropertyChange
event but that wouldn't get you items flagged from the context menu since
those might not be selected.

  #4  
Old December 17th 07, 03:25 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to detect flag event from vba?

It's the ItemChange event of the Items collection of the folder, as I said
originally. Look in the Object Browser for the Items collection and look at
its events.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
...
I dont see any itemchange event in thisoutlooksession. Can you
explain with example?

On Dec 13, 8:13 pm, "Ken Slovak - [MVP - Outlook]"
wrote:
You'd have to handle the ItemChange event of the Items collection and
check
to see what was changed. An alternative would be to instantiate event
handlers for any selected or open item and handle the item.PropertyChange
event but that wouldn't get you items flagged from the context menu since
those might not be selected.


  #5  
Old December 26th 07, 08:11 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 10
Default How to detect flag event from vba?

On Dec 17, 7:25*pm, "Ken Slovak - [MVP - Outlook]"
wrote:
It's the ItemChange event of the Items collection of the folder, as I said
originally. Look in the Object Browser for the Items collection and look at
its events.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm

wrote in message

...



I dont see any itemchange event in thisoutlooksession. Can you
explain with example?


On Dec 13, 8:13 pm, "Ken Slovak - [MVP - Outlook]"
wrote:
You'd have to handle the ItemChange event of the Items collection and
check
to see what was changed. An alternative would be to instantiate event
handlers for any selected or open item and handle the item.PropertyChange
event but that wouldn't get you items flagged from the context menu since
those might not be selected.- Hide quoted text -


- Show quoted text -


I just don't get how to activate that event. for example i want to
show a message box once a mail is flagged.
can you show me how?
  #6  
Old December 26th 07, 03:30 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to detect flag event from vba?

Well, you didn't mention what types of items were being flagged or in what
folder or folders, but this would work for mail items in the Inbox. This
code would be in ThisOutlookSession:

Dim WithEvents colItems As Outlook.Items
Dim oFolder As Outlook.MAPIFolder

Private Sub Application_Startup()
Dim oNS As Outlook.NameSpace

Set oNS = Application.GetNameSpace("MAPI")
Set oFolder = oNS.GetDefaultFolder(olFolderInbox)
Set colItems = oFolder.Items
End Sub

Private Sub colItems_ItemChange(Item As Object)
If Item.FlagStatus = OlFlagStatus.olFlagMarked Then
' show MsgBox here or whatever
End If
End Sub

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
...
snip
I just don't get how to activate that event. for example i want to
show a message box once a mail is flagged.
can you show me how?

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving Flag Status flag in Outlook 2007 Gary C. Outlook - Installation 1 June 20th 07 12:13 AM
Search of an event fired immediate before Quit-event Peter Ostermann Outlook and VBA 4 April 6th 07 08:46 AM
PropertyChange event can not detect changes in Body? jiun Outlook and VBA 1 December 23rd 06 10:12 AM
Problem with CommandBarComboBox Change Event (Event fires only once) M. Khalid Farooq Add-ins for Outlook 1 October 19th 06 03:34 PM
Outlook should have an out off office flag link to calender event Mathieu Outlook - Calandaring 2 July 26th 06 12:11 AM


All times are GMT +1. The time now is 07:12 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.