Запустил вот такой код из Visio SDK 2010. Собственно все понятно, кроме того как привязать к кнопке макрос. Onactions убрали?). vsoToolbarItem.CmdNum
надо получать для макроса cmdnum?
Public Sub SetCustomToolbarItems_Example()
Dim vsoUIObject As Visio.UIObject
Dim vsoToolbarSet As Visio.ToolbarSet
Dim vsoToolbar As Visio.Toolbar
Dim vsoToolbarItems As Visio.ToolbarItems
Dim vsoToolbarItem As Visio.ToolbarItem
'Get the UIObject object for the copy of the built-in toolbars.
Set vsoUIObject = Visio.Application.BuiltInToolbars(0)
'Get the drawing window toolbar sets.
'NOTE: Use ItemAtID to get the toolbar set.
'Using vsoUIObject.ToolbarSets(visUIObjSetDrawing) will not work.
Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)
'Create a new toolbar
Set vsoToolbar = vsoToolbarSet.Toolbars.Add
With vsoToolbar
.Caption = "test"
.Position = visBarFloating
.Left = 300
.Top = 200
.Protection = visBarNoHorizontalDock
.Visible = True
.Enabled = True
End With
'Get the ToolbarItems collection.
Set vsoToolbarItems = vsoToolbar.ToolbarItems
'Add a new button in the first position.
Set vsoToolbarItem = vsoToolbarItems.AddAt(0)
'Set properties for the new toolbar button.
vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
vsoToolbarItem.CmdNum = visCmdPanZoom
'Set the toolbar button icon.
vsoToolbarItem.IconFileName "path\filename"
'Use the new custom UI.
ThisDocument.SetCustomToolbars vsoUIObject
End Sub