Hi
you can use the UIObject to add a costum toolbar to your drawing document(reccomended, this way the toolbar appears only when the appropriate drawing document is active) or to the application (Open/Activate an other drawing document and the costum toolbar is still there) .
here is some of my work, if you want to test it yourself make shure that the active document is the document that has the macro,
my macro name is "Compile" and its located in ShowInMenu Module,
Public Sub AddToolbar()
Dim vsoUIObject As Visio.UIObject
Dim vsoToolbarSet As Visio.ToolbarSet
Dim vsoToolbarItems As Visio.ToolbarItems
Dim vsoToolbarItem As Visio.ToolbarItem
Dim vsoToolbar As Visio.Toolbar
Dim DrawingDoc As Document
Set DrawingDoc = ActiveDocument
If Not DrawingDoc.CustomToolbars Is Nothing Then
Exit Sub
End If
'Get the UIObject object
Set vsoUIObject = Application.BuiltInToolbars(0)
'Get the drawing window toolbar sets.
Set vsoToolbarSet = vsoUIObject.ToolbarSets.ItemAtID(visUIObjSetDrawing)
'Get the new Toolbar from Toolbars colection
Set vsoToolbar = vsoToolbarSet.Toolbars.Add
vsoToolbar.Caption = "MyToolBar"
vsoToolbar.Position = visBarTop
Set vsoToolbarItems = vsoToolbar.ToolbarItems
'Add a new button
Set vsoToolbarItem = vsoToolbarItems.Add
vsoToolbarItem.CntrlType = visCtrlTypeBUTTON
Dim PicturePath As String
PicturePath = "C:\...\Picture\"
'Set the properties for the new menu item
vsoToolbarItem.Caption = "Compile"
vsoToolbarItem.AddOnName = "ShowInMenu.Compile"
vsoToolbarItem.IconFileName PicturePath & "compile.ico"
' Add the toolBar to the active document
DrawingDoc.SetCustomToolbars vsoUIObject
' Add the toolBar to the application
' Application.SetCustomToolbars vsoUIObject
End Sub
if an other document has the macro (One of your stencils for exmple), the other document must be in the references list of the toolbar Document, And AddOnName property should be - OtherDocumentName.ModuleThatHasTheMacro.MacroName
Good luck!, Vidush.