rrhandle8
asked on
Outlook VBA set flag
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.
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
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
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
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ReneD100 & thims,
I tried both suggestions. Nothing.
I tried both suggestions. Nothing.
ASKER
Maybe I defined it wrong
Dim oNS As Outlook.NameSpace
Dim oFolder As Outlook.MAPIFolder
Dim oItem As Variant
Dim oNS As Outlook.NameSpace
Dim oFolder As Outlook.MAPIFolder
Dim oItem As Variant
ASKER
Set it to
Dim oItem As mailItem
still nothing
Dim oItem As mailItem
still nothing
Are you sure your
If InStr(oItem.Subject, "Information about your order (#") > 0 Then
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)
ASKER
Oh yes. It works. U did a F9 on the FlagStatus like to make sure.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did a F9 on the FlagStatus line to make sure.
ASKER
I missed the oItem.save Duh!
glad to help!
Open in new window