MailItem Methods
See below for the various methods available to the MailItem Object. I've encapsulated each method into its own function.
I did not include sample code for each function. All you need to do is pass a MailItem Object to each function. See The MailItem Object for sample code to create MailItems in several ways.
An ideal usage for these functions would be in a loop, where you call the function on each MailItem in a folder.
ClearConversationIndex Method
Function ClearMailItemCI(msg As Outlook.MailItem)
msg.ClearConversationIndex
End Function
msg.ClearConversationIndex
End Function
Close Method
Function CloseMsg(msg As Outlook.MailItem, SaveNote As _
Outlook.OlInspectorClose)
msg.Close SaveNote
End Function
Outlook.OlInspectorClose)
msg.Close SaveNote
End Function
Copy Method
Function CopyMsg(msg As Outlook.MailItem) As Outlook.MailItem
Set CopyMsg = msg.Copy
End Function
Set CopyMsg = msg.Copy
End Function
Delete Method
Function deleteMsg(msg As Outlook.MailItem)
msg.Delete
End Function
msg.Delete
End Function
Display Method
Function DisplayMsg(msg As Outlook.MailItem, Optional displayMode As Variant)
If Not IsMissing(displayMode) Then
If CBool(displayMode) Then
msg.Display displayMode
End If
End If
End Function
If Not IsMissing(displayMode) Then
If CBool(displayMode) Then
msg.Display displayMode
End If
End If
End Function
Forward Method
Function ForwardMsg(msg As Outlook.MailItem) As Outlook.MailItem
Set ForwardMsg = msg.Forward
End Function
Set ForwardMsg = msg.Forward
End Function
Move Method
Function MoveMsg(msg As Outlook.MailItem, _
fldr As Outlook.MAPIFolder) As Outlook.MailItem
Set MoveMsg = msg.Move(fldr)
End Function
fldr As Outlook.MAPIFolder) As Outlook.MailItem
Set MoveMsg = msg.Move(fldr)
End Function
PrintOut Method
Function PrintMsg(msg As Outlook.MailItem)
msg.PrintOut
End Function
msg.PrintOut
End Function
Reply Method
Function ReplyMsg(msg As Outlook.MailItem) As Outlook.MailItem
Set ReplyMsg = msg.Reply
End Function
Set ReplyMsg = msg.Reply
End Function
ReplyAll Method
Function ReplyAllMsg(msg As Outlook.MailItem) As Outlook.MailItem
Set ReplyAllMsg = msg.ReplyAll
End Function
Set ReplyAllMsg = msg.ReplyAll
End Function
Save Method
Function SaveMsg(msg As Outlook.MailItem)
msg.Save
End Function
msg.Save
End Function
SaveAs Method
Function SaveMsgAs(msg As Outlook.MailItem, filePath As String, _
Optional fileType As OlSaveAsType = olTXT)
msg.SaveAs filePath, fileType
End Function
Optional fileType As OlSaveAsType = olTXT)
msg.SaveAs filePath, fileType
End Function
Send Method
Function SendMsg(msg As Outlook.MailItem)
msg.Send
End Function
msg.Send
End Function
ShowCategoriesDialog Method
Function MsgCategoriesDialog(msg As Outlook.MailItem)
msg.ShowCategoriesDialog
End Function
msg.ShowCategoriesDialog
End Function