Outlook add-in - adding to the Appointments Insert menu

S

Scott Lyon

I have been tasked with updating one of our legacy add-ins for Outlook. And
by "legacy", I mean that it was written entirely in VB6, with no immediate
plans to rewrite/update to .NET.


Currently the add-in (among other things) adds a custom menu to the Insert
menu when drafting an e-mail message.


I have been tasked with adding the same custom menu to the Insert Menu when
drafting a Meeting Request or Appointment.



The code I have for initially setting up the Message Insert menu is as
follows:


Dim NewInsertMenu As CommandBarPopup
Dim NewRefPopUp As CommandBarPopup


Set NewInsertMenu = colCB.FindControl(id:="30005")

Set PMCRefPopUp = NewInsertMenu
NewRefPopUp.Caption = "NewInsertSubMenu"
NewRefPopUp.BeginGroup = True
NewRefPopUp.Tag = "NewInsertSubMenu"



Unfortunately, I'm at a loss to figure out how to add that same menu to the
Appointments Insert menu.


Any ideas/suggestions?


I was hoping it'd just be a different Control ID (to replace the 30005 in
the code above), but I'm simply not finding it online or otherwise.


Thanks!
 
K

Ken Slovak - [MVP - Outlook]

Are PMCRefPopUp and colCB declared somewhere?

Using this quickie VBA snippet I got the Insert menu from an open
appointment item that was ActiveInspector:

Dim NewInsertMenu As CommandBarPopup

Set NewInsertMenu = _
Application.ActiveInspector.CommandBars("Menu
Bar").FindControl(ID:="30005")
 
S

Scott Lyon

Sorry about that. That's what I get for trying to clip out code before
posting - mistakes and cutting too much.

Here's a better representation of the code:


Dim NewInsertMenu As CommandBarPopup
Dim NewRefPopUp As CommandBarPopup
Dim colCB As Office.CommandBars
Public WithEvents myItems As Inspectors


Private Sub myItems_NewInspector(ByVal Inspector As outlook.Inspector)

Set colCB = Inspector.CommandBars

Set NewInsertMenu = colCB.FindControl(id:="30005")

Set NewRefPopUp.Caption = NewInsertMenu
NewRefPopUp.Caption = "NewInsertSubMenu"
NewRefPopUp.BeginGroup = True
NewRefPopUp.Tag = "NewInsertSubMenu"

' the rest of the code for the sub-menu here

End Sub


The thing that's strange, is while this adds the new sub-menu to the Insert
menu when editing an E-mail message, it does not add a new sub-menu to the
Insert menu when editing an Appointment.



-Scott
 
K

Ken Slovak - [MVP - Outlook]

Are you getting a handle to the Insert menu? It should work for any item
type except for notes (IPM.StickyNote), those are brain dead.
 

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