Command Bar ID

I want command bar - id of recall a message.
I have written this code, but this gives me action menu of main menu from outlook.
I want menubar of the sentmail which i have opened, so that i can goto action and then recall message.....

Sub ids()

Dim oBar As CommandBarControl
Dim oItem As CommandBarControl

Set oBar = ActiveExplorer.CommandBars("Menu Bar").Controls("Actions")
For Each oItem In oBar.Controls
Debug.Print oItem.Caption, oItem.ID
Next

End Sub
[516 byte] By [v_gyku] at [2007-11-19 14:08:18]
# 1 Re: Command Bar ID
I think you mean this:

CommandBar: Tools
Control: Recall This Message...
ID: 2511

Pieter
PM_ at 2007-11-9 20:28:47 >
# 2 Re: Command Bar ID
First of all like I posted before in your other thread, even if you get the id and invoke the menuitem you will still have to interact with the popup dialog window to set your options and click the Ok button. Event if you could do that it still is only supported if both you and the receipient are running Outlook in an Exchange server environment or else it will fail.

Also, if they have already opened it or previewed it your call will fail. I dont think this is a good idea to be programming.
RobDog888 at 2007-11-9 20:29:47 >
# 3 Re: Command Bar ID
Hey RobDog, I agree with u. But this is the requirement of one of our **$$$$. SO i have to do it.

By the way, I have written this small code snippet to check its recalling or not..

Its not working, dont understand wats the problem......

Dim objapp As Outlook.Application
Dim objexpl As Outlook.Explorer
Dim colcb As Office.CommandBars
Dim objcbb As Office.CommandBarButton

Private Sub cmdrecall_Click()
On Error Resume Next

Set objapp = CreateObject("Outlook.Application")
Set objexpl = objapp.ActiveExplorer
Set colcb = objexpl.CommandBars
Set objcbb = colcb.FindControl(ID:=2511)
If Not objcbb Is Nothing Then
objcbb.Execute
End If

Set objcbb = Nothing
Set colcb = Nothing
Set objexpl = Nothing
Set objapp = Nothing

End Sub

Its taking objcbb as nothing...
v_gyku at 2007-11-9 20:30:50 >
# 4 Re: Command Bar ID
Thats because the Recall message menu item is on the .ActiveInspector and not the .ActiveExplorer. You will have to create a new inspector in order to initialize the ActiveInspector.
RobDog888 at 2007-11-9 20:31:55 >
# 5 Re: Command Bar ID
Dim objapp As outlook.Application
Dim objinsp As outlook.Inspector
Dim colcb As office.CommandBars
Dim objcbb As office.CommandBarButton

Private Sub cmdrecall_Click()
On Error Resume Next

Set objapp = CreateObject("Outlook.Application")
Set objinsp = Item.GetInspector
'MsgBox (objapp.ActiveInspector)
Set colcb = objapp.ActiveInspector.CommandBars
Set objcbb = colcb.FindControl(, 756)
If Not objcbb Is Nothing Then
objcbb.Execute

Sir, This code is taking the activewindow of outlook.(I have opened one of the sent messages.).Its giving the name of that window.

But now why its not executing the recall button?

If u can plz modify the code......
(756-select all)
v_gyku at 2007-11-9 20:32:54 >