ボタンを作成する方法を見つけたので、ボタンを押すと次の機能が実行されるようにしたいと思います。
<-ボタン->
Sub AddButton()
Dim cb As CommandBar
Set cb = Application.CommandBars.Add("additional_toolbar", msoBarTop, , True)
With cb.Controls.Add(msoControlButton)
.Caption = "click me"
.OnAction = "macro_name"
.Style = msoButtonCaption
End With
cb.Visible = True
End Sub
<-実行してもらいたいアクション->
Sub CopySizeAndPosition()
' Usage: Select two shapes. The size and position of
' the first shape selected will be copied to the second.
Dim w As Double
Dim h As Double
Dim l As Double
Dim t As Double
With ActiveWindow.Selection.ShapeRange(1)
w = .Width
h = .Height
End With
With ActiveWindow.Selection.ShapeRange(2)
.Width = w
.Height = h
End With
End Sub
どうすればそれができるか知っていますか?