View Single Post
 
Old 07-20-2021, 09:20 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Based on your comments, create a new category 'Completed' and apply it to messages that are completed. Perhaps better still, create a new mail folder, again called 'Completed' (or whatever suits you better) and move the completed messages to it. The following Outlook macro will categorise the message as completed and move it to a sub folder of Inbox called 'Completed', which it will create if not already present,
Code:
Option Explicit

Sub CompletedMsg()
Dim olMsg As MailItem
Dim olFolder As Outlook.Folder
Dim bExists As Boolean
Const sFolderName As String = "Completed"    'the name of the Completed folder
    On Error Resume Next
    Select Case Outlook.Application.ActiveWindow.Class
        Case olInspector
            Set olMsg = ActiveInspector.currentItem
        Case olExplorer
            Set olMsg = Application.ActiveExplorer.Selection.Item(1)
    End Select
    For Each olFolder In Session.GetDefaultFolder(olFolderInbox).folders
        If olFolder.Name = sFolderName Then
            bExists = True
            Exit For
        End If
    Next olFolder
    If Not bExists = True Then
        Set olFolder = Session.GetDefaultFolder(olFolderInbox).folders.Add(sFolderName)
    End If
    olMsg.UnRead = False
    olMsg.Categories = "Completed"    'optional
    olMsg.Move olFolder

lbl_Exit:
    Set olMsg = Nothing
    Set olFolder = Nothing
    Exit Sub
End Sub
Add the macro to the ribbon for a single click operation.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote