Toolbar.Enabled-Eigenschaft (Visio)

Bestimmt, ob ein Objekt aktuell aktiviert ist oder nicht. Lese-/Schreibzugriff.

Syntax

Ausdruck. Aktiviert

Ausdruck Eine Variable, die ein Toolbar-Objekt darstellt.

Rückgabewert

Boolesch

Beispiel

Das folgende Beispiel zeigt, wie die Enabled-Eigenschaft verwendet werden kann, um eine Symbolleiste ein- oder auszublenden. In dem Beispiel wird der Toolbars-Auflistung eine benutzerdefinierte Symbolleiste hinzugefügt. Diese Symbolleiste wird in der Visio-Benutzeroberfläche angezeigt und ist verfügbar, während das Dokument aktiv ist.

Rufen Sie nach Ausführung dieses Makros die ThisDocument.ClearCustomToolbars-Methode auf, um die integrierten Visio-Symbolleisten wiederherzustellen.

 
Sub Enabled_Example() 
 
 Dim vsoUIObject As Visio.UIObject 
 Dim vsoToolbars As Visio.Toolbars 
 Dim vsoToolbar As Visio.Toolbar 
 Dim vsoToolbarItem As Visio.ToolbarItem 
 
 'Check whether there are document custom toolbars. 
 If ThisDocument.CustomToolbars Is Nothing Then 
 
 'Check whether there are application custom toolbars. 
 If Visio.Application.CustomToolbars Is Nothing Then 
 
 'Use the built-in toolbars. 
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0) 
 
 Else 
 
 'Use the application custom toolbars. 
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone 
 
 End If 
 
 Else 
 
 'Use the document custom toolbars. 
 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 
 
 'Set the title of the toolbar. 
 vsoToolbar.Caption = "Example" 
 
 'Enable hiding or showing the toolbar. 
 vsoToolbar.Enabled = True 
 
 'Show the toolbar. 
 vsoToolbar.Visible = True 
 
 'Add an item to the toolbar. 
 Set vsoToolbarItem = vsoToolbar.ToolbarItems.Add 
 With vsoToolbarItem 
 
 'Set the new item to be a button. 
 .CntrlType = Visio.visCtrlTypeBUTTON 
 
 'Set the icon of the new button. 
 .FaceID = Visio.visIconIXCUSTOM_CARDS 
 
 'Set the CmdNum property of the new button. 
 .CmdNum = 1 
 
 'Set the Width property of the new button 
 'wide enough that the toolbar name is readable. 
 .Width = 100 
 
 End With 
 
 'Tell Visio to use the new UIObject object while 
 'this document is active. 
 ThisDocument.SetCustomToolbars vsoUIObject 
 
End Sub

Support und Feedback

Haben Sie Fragen oder Feedback zu Office VBA oder zu dieser Dokumentation? Unter Office VBA-Support und Feedback finden Sie Hilfestellung zu den Möglichkeiten, wie Sie Support erhalten und Feedback abgeben können.