Compartir a través de


Propiedad UIObject.Clone (Visio)

Devuelve una copia del objeto UIObject. Solo lectura.

Sintaxis

expresión. Clone

Expresión Variable que representa un objeto UIObject .

Valor devuelto

UIObject

Ejemplo:

En este ejemplo se muestra cómo usar la propiedad Clone para hacer una copia de un objeto UIObject. En el ejemplo se agrega una barra de herramientas personalizada a la colección de barras de herramientas clonadas. Esta barra de herramientas aparecerá en la interfaz de usuario de Microsoft Visio y estará disponible mientras el documento se encuentre activo.

Para restaurar las barras de herramientas integradas de Visio después de ejecutar la macro, llame al método ThisDocument.ClearCustomToolbars.

 
Sub Clone_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 
 
 '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 = "My New Toolbar" 
 
 'Tell Visio to use the new UIObject object while 
 'this document is active. 
 ThisDocument.SetCustomToolbars vsoUIObject 
 
End Sub

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.