S
Sydney
Hi, im using visio 2002 and xp developer.
I copied some code from the help files to create a toolbar The menu
creates itself beautifully but I cant get the OnAction to work, the error
reads : Method OnAction of object 'commandbarpopup' failed.
Any ideas would be appreciated.
Sub AddMenuToMenuBar() ' (vsoApplication As Visio.Application)
' Abstract - This procedure gets the active MenuBar from
' Visio and adds a Menu at the end called "Custom".
Dim cbrCommandBars As Office.CommandBars
Dim cbrMenuBar As Office.CommandBar
Dim cbrMenuPopup As Office.CommandBarPopup
Dim vsoApplication As Visio.Application
' Get the CommandBars collection from Visio.
Set vsoApplication = Visio.Application
Set cbrCommandBars = vsoApplication.CommandBars
' Get the active menu bar from the CommandBars collection.
Set cbrMenuBar = cbrCommandBars.ActiveMenuBar
Set cbrMenuPopup = cbrMenuBar.Controls.Add(Type:=msoControlPopup,
Temporary:=True)
With cbrMenuPopup
.Caption = "Visio Footer"
.Controls.Add.Caption = "Insert Footer"
.OnAction = "VIFooter" ' sub with footer code in the same module
fails..so close but not quite!
.TooltipText = "Insert a footer into the document"
End With
End Sub
I copied some code from the help files to create a toolbar The menu
creates itself beautifully but I cant get the OnAction to work, the error
reads : Method OnAction of object 'commandbarpopup' failed.
Any ideas would be appreciated.
Sub AddMenuToMenuBar() ' (vsoApplication As Visio.Application)
' Abstract - This procedure gets the active MenuBar from
' Visio and adds a Menu at the end called "Custom".
Dim cbrCommandBars As Office.CommandBars
Dim cbrMenuBar As Office.CommandBar
Dim cbrMenuPopup As Office.CommandBarPopup
Dim vsoApplication As Visio.Application
' Get the CommandBars collection from Visio.
Set vsoApplication = Visio.Application
Set cbrCommandBars = vsoApplication.CommandBars
' Get the active menu bar from the CommandBars collection.
Set cbrMenuBar = cbrCommandBars.ActiveMenuBar
Set cbrMenuPopup = cbrMenuBar.Controls.Add(Type:=msoControlPopup,
Temporary:=True)
With cbrMenuPopup
.Caption = "Visio Footer"
.Controls.Add.Caption = "Insert Footer"
.OnAction = "VIFooter" ' sub with footer code in the same module
fails..so close but not quite!
.TooltipText = "Insert a footer into the document"
End With
End Sub