Postitem - revise content

J

JimRBG

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
 
K

Ken Slovak - [MVP - Outlook]

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.
 
J

JimRBG

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
 
K

Ken Slovak - [MVP - Outlook]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top