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:
Joined
Sep 16, 2008
Messages
3
Reaction score
0
Who knows the solution for firing the OnAction event, please let me know.
 

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