PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Adding Item to the Email Actions Menu

Reply

Adding Item to the Email Actions Menu

 
Thread Tools Rate Thread
Old 05-08-2004, 04:31 PM   #1
StudioTwo
Guest
 
Posts: n/a
Default Adding Item to the Email Actions Menu


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
  Reply With Quote
Old 06-08-2004, 07:17 PM   #2
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
 
Posts: n/a
Default RE: Adding Item to the Email Actions Menu

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
>

  Reply With Quote
Old 02-09-2004, 08:45 AM   #3
StudioTwo
Guest
 
Posts: n/a
Default Re: Adding Item to the Email Actions Menu

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/
>
>

  Reply With Quote
Old 03-09-2004, 11:05 AM   #4
Stephen \(StudioTwo\)
Guest
 
Posts: n/a
Default Re: Adding Item to the Email Actions Menu

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/
> > >
> > >

> >



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off