VBA Basics

Joined
Sep 16, 2008
Messages
3
Reaction score
0
Hi am new to VBA,
i write a small code in VBA for creating a toolbar button in outlook.The button displyed fine in outlook,but when we clik's it,it was't fired.Can any one helpegarding firing the button.

Here is the code,

Private Sub Application_Startup()
Dim tlbCustomBar As CommandBar
Dim btnNewCustom As CommandBarButton

Set tlbCustomBar = Application.ActiveExplorer _
.CommandBars _
.Add(Name:="Custom Applications", _
Position:=msoBarTop, Temporary:=True)

tlbCustomBar.Visible = True

Set btnNewCustom = _
tlbCustomBar.Controls.Add(Type:=msoControlButton)

btnNewCustom.Caption = "Tool_buttonl"
With btnNewCustom
.Style = msoButtonCaption
.Visible = True
.OnAction = "click_func"
End Sub

Public Function click_func()
MsgBox "Sample App"
End Function
 
Last edited:
Back
Top