Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Outlook VBA set flag

Posted on 2014-10-27
12
Medium Priority
?
243 Views
Last Modified: 2014-10-27
I can read the emails, so I know oItem is set correctly.
I cannot find a way to set a flag or anything else for the particular emails
I have Outlook 2010.


 For Each oItem In oFolder.Items
    If InStr(oItem.Subject, "Information about your order (#") > 0 Then
        oItem.FlagRequest = "Follow up"
    end if
 Next

Open in new window

0
Comment
Question by:rrhandle8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 5

Expert Comment

by:ReneD100
ID: 40407215
not 100% sure, but try this:
For Each oItem In oFolder.Items
    If InStr(oItem.Subject, "Information about your order (#") > 0 Then
        oItem.FlagRequest = "Follow up"
        oItem.FlagStatus = olFlagMarked           'olNoFlag / olFlagComplete are also available
    end if
 Next

Open in new window

0
 
LVL 14

Expert Comment

by:Alexei Kuznetsov (Outlook MVP)
ID: 40407223
FlagRequest is a text property that specifies the text associated with a flag. In order to enable the flag itself, you need to set the FlagStatus property. In addition, you can set FlagIcon property if needed:
olItem.FlagStatus = 2
olItem.FlagRequest = "Follow up"
olItem.FlagIcon = 6

Open in new window

FlagStatus can take the value of 0 (no flag), 1 (complete) or 2 (marked). See FlagIcon values on MSDN: http://msdn.microsoft.com/en-us/library/office/ff960469(v=office.15).aspx
0
 
LVL 16

Assisted Solution

by:Joshua Grantom
Joshua Grantom earned 2000 total points
ID: 40407232
Also need to save.

 For Each oItem In oFolder.Items
    If InStr(oItem.Subject, "Information about your order (#") > 0 Then
        oItem.FlagStatus = 2
        oItem.FlagRequest = "Follow up"
        oItem.FlagIcon = 6
        oItem.Save
    end if
 Next

Open in new window

0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:rrhandle8
ID: 40407236
ReneD100 & thims,
I tried both suggestions.  Nothing.
0
 

Author Comment

by:rrhandle8
ID: 40407242
Maybe I defined it wrong

 Dim oNS As Outlook.NameSpace
 Dim oFolder As Outlook.MAPIFolder
 Dim oItem As Variant
0
 

Author Comment

by:rrhandle8
ID: 40407245
Set it to
 Dim oItem As mailItem
still nothing
0
 
LVL 14

Expert Comment

by:Alexei Kuznetsov (Outlook MVP)
ID: 40407249
Are you sure your
If InStr(oItem.Subject, "Information about your order (#") > 0 Then

Open in new window

condition is correct and works for your items? Try to MsgBox after this line to make sure it works. If not, try this:
InStr(1, olItem.Subject, "Information about your order (#", vbTextCompare)

Open in new window

0
 

Author Comment

by:rrhandle8
ID: 40407258
Oh yes.  It works. U did a F9 on the FlagStatus like to make sure.
0
 
LVL 16

Accepted Solution

by:
Joshua Grantom earned 2000 total points
ID: 40407259
did you try oItem.Save from above?
0
 

Author Comment

by:rrhandle8
ID: 40407262
I did a F9 on the FlagStatus line to make sure.
0
 

Author Comment

by:rrhandle8
ID: 40407267
I missed the oItem.save Duh!
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40407272
glad to help!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question