Postitem - revise content

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following code:

Set olApp = Outlook.Application
Set onsMapi = olApp.GetNamespace("MAPI")
Set ofldrSrc = olApp.ActiveExplorer.CurrentFolder
Set OlExp = olApp.ActiveExplorer
Set OlSel = OlExp.Selection
Set objPost = OlExp.Selection.Item(1)
objPost.Display

This dispalys an existing post item. I need to be able to revise this post,
so I choose EDIT, Revise Contents; and the post is changed to editable
version that I can modify. I wold like the code to automatically open the
post item in 'revise contents' mode. Is there a way to do this
programatically?

Thanks,

Jim
 
You'd have to get the ID of the menu item you want and get it as a
CommandBarControl or CommandBarButton object and then call its Execute
method. That's about the only way.
 
Thanks Ken,

Here is what I came up with.

Sub myRevisePost()
Dim olApp As Outlook.Application
Dim objPost As Outlook.PostItem
Dim olExp As Outlook.Explorer
Dim olSel As Outlook.Selection
' Get the current Folder
Set olApp = Outlook.Application
Set olExp = olApp.ActiveExplorer
Set olSel = olExp.Selection
Set objPost = olExp.Selection.Item(1)
objPost.Display
objPost.GetInspector.CommandBars.Item("Edit").Controls("Revise
Contents").Execute
End Sub
 
That looks good. If you ever want this to be language independent then get
the ID of that menu item and use that instead. You can use FindControl with
recursive set to true to get at the menu item ("Menu Bar" is language
independent) and execute it that way.

Not important for a macro only you will run, but a consideration if you plan
to deploy the code.
 
Back
Top