C
Composer
I want to add an item to the Menu Bar in Outlook 2000.
The code below works fine in Access 2000.
In Outlook, it runs and causes no errors, but the result is not visible
in the menu bar.
Can someone help me understand why it acts differently in the two
applications?
Thanks.
-------------------------------------------------------------------
Public Sub MenuTest()
Dim cbr As CommandBar
Dim cbc As CommandBarControl
Dim ctlHelp As CommandBarControl
Dim ctlMyself As CommandBarPopup
Dim ctlHello As CommandBarButton
Set cbr = CommandBars("Menu Bar")
' Delete my previous effort, if found.
Set cbc = cbr.FindControl(Tag:="me", recursive:=False)
If Not (cbc Is Nothing) Then cbc.Delete
' Insert my item into the main Menu Bar.
Set ctlHelp = cbr.Controls("Help")
Set ctlMyself = cbr.Controls.Add(msoControlPopup,
Before:=ctlHelp.Index, Temporary:=True)
With ctlMyself
.Caption = "Myself"
.Tag = "me"
.Visible = True
End With
' Insert one action item below my menu item.
Set ctlHello = ctlMyself.Controls.Add(msoControlButton,
Temporary:=True)
With ctlHello
.Caption = "Say Hello"
.Tag = "meHello"
.OnAction = "TestAction"
.Visible = True
End With
End Sub
Public Function TestAction()
MsgBox "Hello"
End Function
The code below works fine in Access 2000.
In Outlook, it runs and causes no errors, but the result is not visible
in the menu bar.
Can someone help me understand why it acts differently in the two
applications?
Thanks.
-------------------------------------------------------------------
Public Sub MenuTest()
Dim cbr As CommandBar
Dim cbc As CommandBarControl
Dim ctlHelp As CommandBarControl
Dim ctlMyself As CommandBarPopup
Dim ctlHello As CommandBarButton
Set cbr = CommandBars("Menu Bar")
' Delete my previous effort, if found.
Set cbc = cbr.FindControl(Tag:="me", recursive:=False)
If Not (cbc Is Nothing) Then cbc.Delete
' Insert my item into the main Menu Bar.
Set ctlHelp = cbr.Controls("Help")
Set ctlMyself = cbr.Controls.Add(msoControlPopup,
Before:=ctlHelp.Index, Temporary:=True)
With ctlMyself
.Caption = "Myself"
.Tag = "me"
.Visible = True
End With
' Insert one action item below my menu item.
Set ctlHello = ctlMyself.Controls.Add(msoControlButton,
Temporary:=True)
With ctlHello
.Caption = "Say Hello"
.Tag = "meHello"
.OnAction = "TestAction"
.Visible = True
End With
End Sub
Public Function TestAction()
MsgBox "Hello"
End Function