views:

549

answers:

2

This might be a duplicate of this question?

Is there a way in Outlook 2007 using VBA to set a follow-up flag on an email object? It looks like it was supported in Outlook 2003 with .FlagStatus property, but I can't find it in 2007.

In advance, thanks!

I got a vote for this to be moved to SuperUser and considering this is VBA, it seems that Stackoverflow is the right place. But I am welcome to suggestions.

+1  A: 

This is what http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.%5Fmailitem.flagstatus.aspx has to say:


Dim instance As _MailItem
Dim value As OlFlagStatus

value = instance.FlagStatus

instance.FlagStatus = value
EToreo
+2  A: 

From the outlook change notes:

For Follow Up Flags For Follow Up Flags, introduced in Microsoft Office Outlook 2003, are replaced by task flags and color categories. You no longer see colored flags in the Mail view. If you flagged items in the earlier version of Outlook to indicate that they were important or that they belonged to a particular group, you should now use color categories instead. If you used flags to indicate the time at which you were to take action on an item, you should now use task flags. This change is being made to increase the functionality of flags. With task flagging, you can place an item in the overall task management system, allowing you to see your tasks in the To-Do Bar, Daily Task List in Calendar, and in the Tasks view. By categorizing an item, you can easily scan your Inbox for categorized items, the same way that you might previously have scanned your Inbox for flagged items. You can also find categorized items in the Categorized Mail Search Folders.

So the concept of the flag changed, which is why the FlagStatus property has changed. According to this, the following should work:

Set SelectedItems = Outlook.ActiveExplorer.Selection
    For Each Item In SelectedItems
        With Item
            .ToDoTaskOrdinal = dtTaskDate
            .TaskDueDate = dtTaskDate
            .TaskStartDate = dtTaskDate
            .FlagStatus = 2
            .FlagRequest = strFlagRequest
            .Categories = strCategories
            .FlagIcon = 6
            .Save
        End With
    Next Item
Yishai