If you want to handle conversations, you will need to do this explicitly. You can go from MailItem to his conversation using MailItem.GetConversation, but you better work with conversations directly.
What are you doing:
- Get all conversation headers from current selection
- For each conversation, get separate items
- Do your archiving with them.
The following C # code illustrates this and should be trivial for the VBA port.
Outlook.Selection selection = Application.ActiveExplorer().Selection; Outlook.Selection convHeaders = selection.GetSelection( Outlook.OlSelectionContents.olConversationHeaders) as Outlook.Selection; foreach (Outlook.ConversationHeader convHeader in convHeaders) { Outlook.SimpleItems items = convHeader.GetItems(); for (int i = 1; i <= items.Count; i++) { if (items[i] is Outlook.MailItem) { Outlook.MailItem mail = items[i] as Outlook.MailItem; mail.UnRead = false; mail.Move( archiveFolder ); } // else... not sure how if you want to handle different types of items as well } }
source share