Developer Tool Bar
Jump to navigation
Jump to search
Description
The Developer Tool Bar consists of the most used functions and makes them accessible via mnemonics.
Code
'################################################################################
'# References
'# - Microsoft Visual Basic for Applications Extensibility
'################################################################################
'# createDeveloperToolbar
Public Sub createDeveloperToolbar()
Const blncTemporary As Boolean = False
Dim cbr As Office.CommandBar
With Application.VBE.CommandBars
On Error Resume Next
.Item("Developer").delete
On Error GoTo 0
Set cbr = .add( _
Name:="Developer", _
Position:=msoBarNoCustomize, _
MenuBar:=False, _
Temporary:=blncTemporary _
)
End With
'Comments
createDeveloperButton intId:=192, strCaption:="&Comment"
createDeveloperButton intId:=2552, strCaption:="&Uncomment"
'Bookmarks
createDeveloperButton intId:=2525, strCaption:="B&ookmark", blnBeginGroup:=True
createDeveloperButton intId:=2526, strCaption:="&Next"
createDeveloperButton intId:=2527, strCaption:="&Previous"
createDeveloperButton intId:=2528, strCaption:="Re&move"
'Debug
createDeveloperButton intId:=578, strCaption:="Compi&le", blnBeginGroup:=True
createDeveloperButton intId:=228, strCaption:="&Reset"
cbr.Visible = True
End Sub
Private Sub createDeveloperButton(intId As Integer, strCaption As String, Optional blnBeginGroup As Boolean = False)
Dim cbt As Office.CommandBarButton
Set cbt = Application.VBE.CommandBars("Developer").Controls.add(ID:=intId)
With cbt
.Caption = strCaption
.Style = msoButtonIconAndCaption
.BeginGroup = blnBeginGroup
End With
End Sub