Propriété ToolbarItem.Visible (Visio)

Détermine si un objet est affiché. Lecture-écriture.

Syntaxe

expression. Visible

Expression Variable qui représente un objet ToolbarItem .

Valeur renvoyée

Booléen

Exemple

Cet exemple indique comment utiliser la propriété Visible pour déterminer si un objet UIObject est affiché dans l’interface utilisateur. Cet exemple ajoute une barre d’outils personnalisée à la collection de barres d’outils clonées. Cette barre d’outils apparaît dans l’interface utilisateur de Microsoft Visio et est disponible tandis que le document est actif.

Pour restaurer les barres d'outils intégrées de Visio après avoir exécuté cette macro, appelez la méthode ThisDocument.ClearCustomToolbars.

 
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

Assistance et commentaires

Avez-vous des questions ou des commentaires sur Office VBA ou sur cette documentation ? Consultez la rubrique concernant l’assistance pour Office VBA et l’envoi de commentaires afin d’obtenir des instructions pour recevoir une assistance et envoyer vos commentaires.