Microsoft Office Tutorials and References
In Depth Information
Outlook Procedures
Outlook Procedures
By Suat Ozgur
Most of the Outlook procedures do not have sample files because Outlook does
not store its procedures in files.
Creating Control Buttons
This procedure automatically creates control buttons with VBA code.
The following code shows how to create a custom control button in Outlook. In
the example shown here, a custom button called “Create New Task” is created.
Figure 70 – Creating a Custom Control Button
View the Appendix to learn how to store this procedure
in a Standard module.
Option Explicit¶
' * * * * *¶
Public Sub CreateOutlookCommandBarButton()¶
'Remove the button if it is already existing¶
Call RemoveOutlookCommandBarButton¶
'Create new control button¶
'Temporary:=True : Available from now on¶
'Temporary:=False : Available only this Outlook session¶
With ActiveExplorer.CommandBars("Standard").Controls. _¶
Add(msoControlButton, Temporary:=True)¶
'Caption to display on button¶
.Caption = "Create New Task"¶
'Procedure name to run when button is clicked¶
.OnAction = "CreateTask"¶
'Button Style - msoButtonCaption = 2¶
.Style = 2¶
'Show new button¶
.Visible = True¶
End With¶
End Sub¶
Search JabSto ::

Custom Search