Microsoft Office Tutorials and References
In Depth Information
Outlook Procedures
' * * * * *¶
Public Sub RemoveOutlookCommandBarButton()¶
'Error handler if control is not existing¶
'Continue if an error occurs¶
On Error Resume Next¶
'Remove custom control button¶
ActiveExplorer.CommandBars("Standard") _¶
.Controls("Create New Task").Delete False¶
End Sub¶
The following code shows how to create a custom control button in other Office
applications.
View the Appendix to learn how to store this procedure
in a Standard module.
Option Explicit¶
' * * * * *¶
Public Sub CreateCommandBarButton()¶
'Remove the button if it is already existing¶
Call RemoveCommandBarButton¶
'Create new control button¶
'Temporary:=True : Available from now on¶
'Temporary:=False : Available only this session¶
With Application.CommandBars("Standard").Controls. _¶
Add(msoControlButton, Temporary:=True)¶
'Caption to display on button¶
.Caption = "New Button"¶
'Procedure name to run when button is clicked¶
.OnAction = "MyMacro"¶
'Button Style - msoButtonCaption = 2¶
.Style = 2¶
'Show new button¶
.Visible = True¶
End With¶
End Sub¶
' * * * * *¶
Public Sub RemoveCommandBarButton()¶
'Error handler if control is not existing¶
On Error Resume Next¶
'Remove custom control button¶
Application.CommandBars("Standard") _¶
.Controls("New Button").Delete False¶
End Sub¶
Out
Search JabSto ::




Custom Search