qwerty360
asked on
outlook add-on button
Using VB.net how can I create a button in an outlook add-on to outllook 2007 and hook it to a Click event that calls a function
ASKER
Acutally I am adding a menu item under the "Actions" menu. I was able to add a menu item but I am having trouble now adding an onclick kind of event. I tried the OnAction property but it does not seem to work. Please see the atached code snippet. Thanks.
Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
Dim ActionsCmdBar As Office.CommandBar = Me.Application.Explorers(1).CommandBars("Actions")
Dim myMenuItem As Office.CommandBarButton = ActionsCmdBar.Controls.Add(Office.MsoControlType.msoControlButton)
myMenuItem.Caption = "My Menu Item"
myMenuItem.OnAction = "display_message"
End Sub
Sub display_message()
Microsoft.VisualBasic.MsgBox("test")
End Sub
Sorry to be slow getting back to you.
Try changing the declaration of display_message to
Public Sub display_message()
Try changing the declaration of display_message to
Public Sub display_message()
ASKER
I changed it to " Public Sub display_message()" but still nothing happens when I click on the menu item
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Good deal Glad you have a solution.
Create a button where? A form, the ribbon, in a pane, etc.?