Compartir por


Método Layers.Add (Visio)

Agrega un objeto Layer nuevo a una colección Layers.

Sintaxis

expresión. Agregar (LayerName)

expresión Variable que representa un objeto Layers .

Parameters

Nombre Obligatorio/opcional Tipo de datos Descripción
LayerName Obligatorio String Nombre de la nueva capa.

Valor devuelto

Layer

Ejemplo

La macro siguiente muestra cómo agregar un objeto Layer a la colección Layers.

Public Sub AddLayer_Example() 
 
 Dim vsoDocument As Visio.Document 
 Dim vsoPages As Visio.Pages 
 Dim vsoPage As Visio.Page 
 Dim vsoLayers As Visio.Layers 
 Dim vsoLayer As Visio.Layer 
 
 'Add a document based on the Basic Diagram template. 
 Set vsoDocument = Documents.Add("Basic Diagram.vst") 
 
 'Get the Pages collection and add a page to the collection. 
 Set vsoPages = vsoDocument.Pages 
 Set vsoPage = vsoPages.Add 
 
 'Get the Layers collection and add a layer named "MyLayer" 
 'to the collection. 
 Set vsoLayers = vsoPage.Layers 
 Set vsoLayer = vsoLayers.Add("MyLayer") 
 
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.