Re: MailItem flags
- From: "Ken Slovak - [MVP - Outlook]" <kenslovak@xxxxxxxx>
- Date: Mon, 15 Jan 2007 18:39:33 -0500
Your code works here.
I just commented out the DupQuotes line since I didn't want to bother writing that procedure. It copies the properties correctly.
Are you using Outlook 2007 release version or a beta version?
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Gary E." <GaryE@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:E25D72BB-48C0-4C99-8F06-3AE120F83020@xxxxxxxxxxxxxxxx
"Ken Slovak - [MVP - Outlook]" wrote:
Show the code in your macro.
It's a little long, but here goes (the DupQuotes function doubles any quote
marks it finds in the given string):
Sub SetConversationFlags()
' If the currently selected message has a flag set,
' then this macro finds all the messages within the same conversation
' and gives them the same flag values.
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim sconv As String
Dim sexpiry As String
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
If myOlSel.Count > 1 Then
MsgBox "Please select only one message."
Exit Sub
End If
'See if the flag is set
If myOlSel.Item(1).FlagRequest = "" Then
MsgBox "No flag set."
Else
'Loop through this conversation
sconv = myOlSel.Item(1).ConversationTopic
'Open the Inbox and SentMail folders for searching
Set inbox =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set sentmail =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail)
'Now search the Inbox for all other messages with this same
conversation topic
'(double any single quotes in the string first)
sconv = DupQuotes(sconv)
s$ = "[ConversationTopic] = '" & sconv & "'"
Set myitems = inbox.Items.Restrict(s$)
numitems = myitems.Count
'Set all of the messages in this conversation to the same flag values
For j = 1 To numitems
Set mail = myitems(j)
mail.FlagStatus = myOlSel.Item(1).FlagStatus
mail.FlagDueBy = myOlSel.Item(1).FlagDueBy
mail.FlagRequest = myOlSel.Item(1).FlagRequest
mail.FlagIcon = myOlSel.Item(1).FlagIcon
mail.ReminderSet = myOlSel.Item(1).ReminderSet
mail.ReminderTime = myOlSel.Item(1).ReminderTime
mail.Save
Next j
'now search for the same conversation in the SentMail folder and set
flags there
Set myitems = sentmail.Items.Restrict(s$)
numitems = myitems.Count
'Set all of the messages in this conversation to the same flag values
For j = 1 To numitems
Set mail = myitems(j)
mail.FlagStatus = myOlSel.Item(1).FlagStatus
mail.FlagDueBy = myOlSel.Item(1).FlagDueBy
mail.FlagRequest = myOlSel.Item(1).FlagRequest
mail.FlagIcon = myOlSel.Item(1).FlagIcon
mail.ReminderSet = myOlSel.Item(1).ReminderSet
mail.ReminderTime = myOlSel.Item(1).ReminderTime
mail.Save
Next j
End If
End Sub
.
- Follow-Ups:
- Re: MailItem flags
- From: Gary E.
- Re: MailItem flags
- References:
- Re: MailItem flags
- From: Gary E.
- Re: MailItem flags
- Prev by Date: Re: Outlook 2007/Exchange 2003 error when creating multiple items
- Next by Date: Re: Outlook 2007/Exchange 2003 error when creating multiple items
- Previous by thread: Re: MailItem flags
- Next by thread: Re: MailItem flags
- Index(es):
Relevant Pages
|
Loading