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 change status of a mail marked as a task (VBA)



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 18th 10, 04:03 PM posted to microsoft.public.outlook.program_vba
kradam
external usenet poster
 
Posts: 2
Default How to change status of a mail marked as a task (VBA)

I like Outlook feature of combining tasks and marked as task emails in a
single task view. I can change status of tasks and THESE EMAILS in a table
view.

If I send an email and I flag it then it means for me that the status of
this Task should be set to olTaskWaiting. I do it manualy in a task view but
I decided to create a code snippet to change the status automatically.

I catch ItemAdd event in SentMail folder:

Private Sub myOlItems_ItemAdd(ByVal Item As Object)
If Item.FlagStatus = olFlagMarked Then
Item.Status = olTaskWaiting ' ERROR!
End If
End Sub


When I send a marked email I get an error message" "Object doesn't support
this property or method.". It isn't actually suprising cause MailItem object
doesn't support Status property. How could I change Status of my marked as
tasks emails using VBA?

Outlook 2007, WIN 7
Ads
  #2  
Old May 18th 10, 06:41 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to change status of a mail marked as a task (VBA)

Get the MailItem.PropertyAccessor object and use
PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/81010003")
to set the value you want, which would be a Long.

Note that the property tag value supplied for Status is a DASL property tag
string and not an URL.

--
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


"kradam" wrote in message
...
I like Outlook feature of combining tasks and marked as task emails in a
single task view. I can change status of tasks and THESE EMAILS in a table
view.

If I send an email and I flag it then it means for me that the status of
this Task should be set to olTaskWaiting. I do it manualy in a task view
but
I decided to create a code snippet to change the status automatically.

I catch ItemAdd event in SentMail folder:

Private Sub myOlItems_ItemAdd(ByVal Item As Object)
If Item.FlagStatus = olFlagMarked Then
Item.Status = olTaskWaiting ' ERROR!
End If
End Sub


When I send a marked email I get an error message" "Object doesn't support
this property or method.". It isn't actually suprising cause MailItem
object
doesn't support Status property. How could I change Status of my marked as
tasks emails using VBA?

Outlook 2007, WIN 7


  #3  
Old May 27th 10, 11:50 PM posted to microsoft.public.outlook.program_vba
kradam
external usenet poster
 
Posts: 2
Default How to change status of a mail marked as a task (VBA)

Thank you Ken, it was very helpful
 




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
Event of Changing the Task Status Mark Outlook and VBA 4 March 13th 09 11:24 AM
Replace Task Status Enumeration CC Add-ins for Outlook 3 December 10th 08 05:49 PM
How do I create a custom status for a Task in Outlook 2003? Martin Outlook - Using Forms 1 January 29th 07 06:30 AM
Help with Code - Creating Status Report from Task items Steve Outlook and VBA 1 August 2nd 06 06:45 AM
VBA Code to check Task Status [email protected] Outlook and VBA 2 February 3rd 06 07:16 PM


All times are GMT +1. The time now is 04:39 PM.


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.