Re: MailItem flags



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

.



Relevant Pages

  • Re: Task Scheduler - Quick Question - Code Included
    ... > 'If this flag is clear, ... > Public Function AddScheduleTask(strTime As String, strCommand As String, _ ... > Dim strComputerName As String ...
    (microsoft.public.vb.general.discussion)
  • Re: MailItem flags
    ... ' If the currently selected message has a flag set, ... Dim myOlApp As New Outlook.Application ... Dim sconv As String ... For j = 1 To numitems ...
    (microsoft.public.outlook.program_vba)
  • Task Scheduler - Quick Question - Code Included
    ... 'If this flag is clear, ... Public Function AddScheduleTask(strTime As String, strCommand As String, _ ... Dim strComputerName As String ...
    (microsoft.public.vb.general.discussion)
  • RE: Update SQL Error
    ... I am doing it this way because I have 9 flag fields and I don't want to have ... Private Sub btn_ClFlag_Click ... Dim flgFieldNo As String ...
    (microsoft.public.access.formscoding)
  • hack that key validation.
    ... Public Sub New(ByVal code As String) ... Dim flag As Boolean = False ... Private Function CheckMiszung(ByVal kodProduktu As String, ...
    (microsoft.public.dotnet.languages.vb)

Loading