PostItem Methods

The PostItem Object has a few methods which you will need to use when working with them. Rather than calling each method inline, I prefer to "outsource" these method calls to their own encapsulated functions.

I did not include sample code with these functions. All you need to do is pass a PostItem to each. You may want to view NoteItem Methods for sample code for doing so, along with The PostItem Object for ways of creating PostItem Objects.

Clear Conversation Index

Function ClearPostCI(post As Outlook.PostItem)
  post.ClearConversationIndex
End Function

Close and save PostItem

Function ClosePost(post As Outlook.PostItem, SavePost As _
                                             Outlook.OlInspectorClose)
  post.Close SavePost
End Function

Create a copy of a Post

Function CopyPost(post As Outlook.PostItem) As Outlook.PostItem
  Set CopyPost = post.Copy
End Function

Delete a given post

Function DeletePost(post As Outlook.PostItem)
  post.Delete
End Function

Display a Post

This function uses an Enum section for a custom parameter. The Enum section should be placed at the top of a standard module, or in its own module (with other Enums).

Public Enum displayMode
  vbModeless
  vbModal
End Enum

Function DisplayPost(post As Outlook.PostItem, Optional displayMode As displayMode = vbModal)
  post.Display displayMode
End Function

Forward a post

Function ForwardPost(post As Outlook.PostItem) As Outlook.PostItem
  Set ForwardPost = post.Forward
End Function

Move a post

You'll also need to provide a MAPIFolder object to this function. How you choose to create that reference is up to you.

Function MovePost(post As Outlook.PostItem, _
                  fldr As Outlook.MAPIFolder) As Outlook.PostItem
  Set MovePost = post.Move(fldr)
End Function

Send a post

The PostItem.Post method is equivalent to the MailItem.Send Method.

Function SendPost(post As Outlook.PostItem)
  post.post
End Function

Print a post

Function PrintPost(post As Outlook.PostItem)
  post.PrintOut
End Function

Reply to a post

This function returns a copy of the post (as a MailItem) to the calling procedure as a Post reply.

Function ReplyToPost(post As Outlook.PostItem) As Outlook.MailItem
' returns MailItem
  Set ReplyToPost = post.Reply
End Function

Save a post

Function SavePost(post As Outlook.PostItem)
  post.Save
End Function

Save a post to a logical disk

Function SavePostAs(post As Outlook.PostItem, filePath As String, _
                    Optional fileType As OlSaveAsType = olTXT)
  post.SaveAs filePath, fileType
End Function

Display the Post Categories dialog box

Function PostCategoriesDialog(post As Outlook.PostItem)
  post.ShowCategoriesDialog
End Function

Site last updated: May 17, 2012

Random Data Generator