PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Adding Item to the Email Actions Menu
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Adding Item to the Email Actions Menu
![]() |
Adding Item to the Email Actions Menu |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hello,
Here is bit of code i used to associate a macro to the "Action" menu within Outlook. However, I really need the option to be avialable on the Action menu of the actual email (when I have the message open). Could anyone advise me how I can reference that menu? Sub AddSaveToContractMenuItem() 'Add The SaveToContract Macro To The File Menu. Dim objCBs As CommandBars, objCBCs As CommandBarControls Dim objCBP As CommandBarPopup, objCBB As CommandBarButton Dim intX As Integer Set objCBs = Application.ActiveExplorer.CommandBars Set objCBP = objCBs.FindControl(, 30131) 'GET THE Mail Actions MENU Set objCBCs = objCBP.Controls Set objCBB = objCBCs.Add objCBB.Caption = "Save To Contract" objCBB.OnAction = "RunSaveToContractForm" End Sub TIA Stephen |
|
|
|
#2 |
|
Guest
Posts: n/a
|
You need to return the CommandBars collection from the Inspector object. The
Explorer object is for the main Outlook windows, while Inspectors are for individual items (e-mails, Tasks, Contacts, etc.). -- Eric Legault - B.A, MCP, MCSD, Outlook MVP -------------------------------------------------- {Private e-mails ignored} Job: http://www.imaginets.com Blog: http://blogs.officezealot.com/legault/ "StudioTwo" wrote: > Hello, > Here is bit of code i used to associate a macro to the "Action" menu > within Outlook. However, I really need the option to be avialable on > the Action menu of the actual email (when I have the message open). > Could anyone advise me how I can reference that menu? > > Sub AddSaveToContractMenuItem() > 'Add The SaveToContract Macro To The File Menu. > > Dim objCBs As CommandBars, objCBCs As CommandBarControls > Dim objCBP As CommandBarPopup, objCBB As CommandBarButton > Dim intX As Integer > > Set objCBs = Application.ActiveExplorer.CommandBars > Set objCBP = objCBs.FindControl(, 30131) 'GET THE Mail Actions > MENU > Set objCBCs = objCBP.Controls > Set objCBB = objCBCs.Add > objCBB.Caption = "Save To Contract" > objCBB.OnAction = "RunSaveToContractForm" > > End Sub > > TIA > Stephen > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Eric,
I am really struggling on this one. Any chance you could give me a pointer? TIA Stephen "Eric Legault [MVP - Outlook]" <elegaultZZZ@REMOVEZZZmvps.org> wrote in message news:<6673D0DF-3823-462A-885B-169D05426E6F@microsoft.com>... > You need to return the CommandBars collection from the Inspector object. The > Explorer object is for the main Outlook windows, while Inspectors are for > individual items (e-mails, Tasks, Contacts, etc.). > > -- > Eric Legault - B.A, MCP, MCSD, Outlook MVP > -------------------------------------------------- > {Private e-mails ignored} > Job: http://www.imaginets.com > Blog: http://blogs.officezealot.com/legault/ > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Ah, I see. There needs to be an open message.
Thank you so much, Stephen "Eric Legault [MVP - Outlook]" <elegaultZZZ@REMOVEZZZmvps.org> wrote in message news:993EDA58-116D-4553-BE0C-6FD9E2C27D0E@microsoft.com... > Sure Stephen. Note the changes I made to your code to retrieve the > CommandBars collection from the Inspector object instead of the Explorer > object. > > Sub AddSaveToContractMenuItem() > 'Add The SaveToContract Macro To The File Menu. > > Dim objCBs As CommandBars, objCBCs As CommandBarControls > Dim objCBP As CommandBarPopup, objCBB As CommandBarButton > Dim intX As Integer > > 'Need an open e-mail message; you could also create a temporary one here > and > 'discard it when the menu item has been added > > If Application.ActiveInspector Is Nothing Then Exit Sub > > 'The CommandBars collection is different for e-mails (an Inspector > object) compared > 'to the CommandBars exposed by the main Outlook window (an Explorer > object) > Set objCBs = Application.ActiveInspector.CommandBars > Set objCBP = objCBs.FindControl(, 30131) 'GET THE Mail Actions MENU > Set objCBCs = objCBP.Controls > Set objCBB = objCBCs.Add > objCBB.Caption = "Save To Contract" > objCBB.OnAction = "RunSaveToContractForm" > End Sub > > -- > Eric Legault - B.A, MCP, MCSD, Outlook MVP > -------------------------------------------------- > {Private e-mails ignored} > Job: http://www.imaginets.com > Blog: http://blogs.officezealot.com/legault/ > > > "StudioTwo" wrote: > > > Eric, > > I am really struggling on this one. > > Any chance you could give me a pointer? > > > > TIA > > Stephen > > > > "Eric Legault [MVP - Outlook]" <elegaultZZZ@REMOVEZZZmvps.org> wrote in message news:<6673D0DF-3823-462A-885B-169D05426E6F@microsoft.com>... > > > You need to return the CommandBars collection from the Inspector object. The > > > Explorer object is for the main Outlook windows, while Inspectors are for > > > individual items (e-mails, Tasks, Contacts, etc.). > > > > > > -- > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > -------------------------------------------------- > > > {Private e-mails ignored} > > > Job: http://www.imaginets.com > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

