![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I’ve added a new menu bar with four buttons to Outlook using this code shown
above (VB code). When it runs, MenuItem1 successfully runs Public sub MenuItem1_Click(). But when I click any of the other buttons, (MenuItem2, MenuItem3, or MenuItem4) they execute all the sub’s assigned to the other buttons MenuItem2_Click, MenuItem3_Click, and MenuItem4_Click, always starting in that order. What am I doing wrong? This is the code I use to add the menu bar and its buttos, VB code: Private Sub AddMenuBar() 'Get the menu bar in the explorer window. menuBar = Me.Application.ActiveExplorer().CommandBars.Active MenuBar() 'verify that menu does not exist and remove it if it does newmenu = Me.Application.ActiveExplorer.CommandBars.ActiveMe nuBar _ .FindControl(Office.MsoControlType.msoControlPopup , , "Calendarios de R y D", True, True) If newmenu IsNot Nothing Then newmenu.Delete(True) End If 'Add new menu menu = menuBar.Controls.Add(Office.MsoControlType.msoCont rolPopup, Temporary:=False) If menu IsNot Nothing Then 'edit the menu properties menu.Caption = "Calendarios de R y D" menu.Tag = "Calendarios de R y D" 'add a submenu to the menu and set its properties MenuItem1 = menu.Controls.Add(Office.MsoControlType.msoControl Button, , , Befo=1, Temporary:=True) MenuItem2 = menu.Controls.Add(Office.MsoControlType.msoControl Button, , , Befo=2, Temporary:=True) MenuItem3 = menu.Controls.Add(Office.MsoControlType.msoControl Button, , , Befo=3, Temporary:=True) MenuItem4 = menu.Controls.Add(Office.MsoControlType.msoControl Button, , , Befo=4, Temporary:=True) With MenuItem1 .Style = Office.MsoButtonStyle.msoButtonIconAndCaption .Caption = "Calculate Baby's Calendar" .FaceId = 65 .Tag = "Tag Cloud Submenu" '.OnAction = "MenuItem1_Click" End With With MenuItem2 .Style = Office.MsoButtonStyle.msoButtonIconAndCaption .Caption = "Calculate Diane's Responsibilities" .FaceId = 66 .Tag = "Otra nube" '.OnAction = "MenuItem2_Click" End With With MenuItem3 .Style = Office.MsoButtonStyle.msoButtonIconAndCaption .Caption = "Free Diane's Unmovables" .FaceId = 65 .Tag = "Otra nube" '.OnAction = "MenuItem3_Click" End With With MenuItem4 .Style = Office.MsoButtonStyle.msoButtonIconAndCaption .Caption = "Create Diane's Unmovables" .FaceId = 65 .Tag = "Otra nube" '.OnAction = "MenuItem4_Click" End With 'Add an event handler to the menu item AddHandler MenuItem1.Click, AddressOf MenuItem1_Click AddHandler MenuItem2.Click, AddressOf menuItem2_Click AddHandler MenuItem3.Click, AddressOf menuItem3_Click AddHandler MenuItem4.Click, AddressOf menuItem4_Click 'Display the new menu menu.Visible = True End If End Sub |
Ads |
#2
|
|||
|
|||
![]()
"RBAiras" wrote in message
... I’ve added a new menu bar with four buttons to Outlook using this code shown above (VB code). Please ask coding questions in microsoft.public.outlook.program_vba -- Brian Tillman [MVP-Outlook] |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to assign icon to a button in Outlook Add-in | paresh | Outlook and VBA | 1 | March 23rd 09 01:18 PM |
Outlook 2003 - custom forms - task assign button dissappears | formation | Outlook - Using Forms | 3 | February 20th 09 03:24 PM |
Add New Menu items to the Tools Menu in Outlook 2007 | Rudy | Outlook - Using Forms | 9 | July 23rd 07 03:58 PM |
Custom Task Form - Assign Button | steve | Outlook - Using Forms | 1 | July 8th 07 07:36 PM |
assign macro to custom toolbar button | Rod Nolan | Outlook and VBA | 1 | September 7th 06 05:34 AM |