Created
August 19, 2012 00:29
-
-
Save dck-jp/3390557 to your computer and use it in GitHub Desktop.
Application.CommandBars.Add Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Attribute VB_Name = "ModuleToolbar" | |
Option Explicit | |
Const toolbarName = "Sample" | |
Sub MakeToolBar() | |
Dim myBar As CommandBar | |
Set myBar = Application.CommandBars.Add( _ | |
Name:=toolbarName, Position:=msoBarFloating) | |
myBar.Visible = True | |
Dim myButton As CommandBarControl | |
Set myButton = myBar.Controls.Add(Type:=msoControlButton) | |
With myButton | |
.style = msoButtonIconAndCaption | |
.OnAction = "SampleAction1" | |
.faceId = 84 | |
.caption = "サンプル1" | |
End With | |
Set myButton = myBar.Controls.Add(Type:=msoControlButton) | |
With myButton | |
.style = msoButtonCaption | |
.OnAction = "SampleAction2" | |
.faceId = 83 | |
.caption = "サンプル2" | |
End With | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment