Table of contents
TOC
Collapse the table of content
Expand the table of content

Toolbar.Visible Property (Visio)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Determines whether an object is visible. Read/write.

Syntax

expression . Visible

expression A variable that represents a Toolbar object.

Return Value

Boolean

Example

This example shows how to use the Visible property to determine if a UIObject object is visible in the user interface. The example adds a custom toolbar to the cloned toolbars collection. This toolbar appears in the Microsoft Visio user interface and is available while the document is active.

To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.


Public Sub Visible_Example() 

 Dim vsoUIObject As Visio.UIObject 
 Dim vsoToolbars As Visio.Toolbars 
 Dim vsoToolbar As Visio.Toolbar 

 'Check whether there are document custom toolbars. 
 If ThisDocument.CustomToolbars Is Nothing Then 

 'If not, check whether there are application custom toolbars. 
 If Visio.Application.CustomToolbars Is Nothing Then 

 'If not, use the built-in toolbars. 
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0) 

 Else 

 'If there are application custom toolbars, clone them. 
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone 

 End If 

 Else 

 'If there are custom toolbars in the document, use them. 
 Set vsoUIObject = ThisDocument.CustomToolbars 

 End If 

 'Get the Toolbars collection for the drawing window context. 
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _ 
 Visio.visUIObjSetDrawing).Toolbars 

 'Add a toolbar to the collection. 
 Set vsoToolbar = vsoToolbars.Add 
 With vsoToolbar 

 'Set the title of the toolbar. 
 .Caption = "My New Toolbar" 

 'Float the toolbar at coordinates (300,200). 
 .Position = Visio.visBarFloating 
 .Left = 300 
 .Top = 200 

 'Make the toolbar visible. 
 .Visible = True 

 End With 

 'Use the custom toolbars in this document. 
 ThisDocument.SetCustomToolbars vsoUIObject 

End Sub
© 2018 Microsoft