Propriedade Master.Layers (Visio)

Retorna a coleção Camadas de um objeto. Somente leitura.

Sintaxe

expression. Layers

Expressão Uma variável que representa um objeto Mestre .

Valor de retorno

Camadas

Exemplo

Esta macro do Microsoft Visual Basic for Applications (VBA) mostra como usar a propriedade Layers para adicionar formas às camadas. Ela também usa a propriedade Layer para obter uma referência a uma camada particular, a propriedade LayerCount para determinar o número de camadas às quais uma forma é atribuída e a propriedade Name para obter o nome da camada atual.

 
Public Sub Layers_Example() 
 
 Dim vsoPage As Visio.Page 
 Dim vsoShape As Visio.Shape 
 Dim vsoLayer As Visio.Layer 
 Dim vsoLayers As Visio.Layers 
 
 If ActiveDocument Is Nothing Then 
 Documents.Add ("") 
 End If 
 
 Set vsoPage = ActivePage 
 If vsoPage Is Nothing Then 
 Set vsoPage = ActiveDocument.Pages(1) 
 End If 
 
 'Draw a rectangle. 
 Set vsoShape = vsoPage.DrawRectangle(1, 5, 5, 1) 
 
 'Get the Layers collection. 
 Set vsoLayers = vsoPage.Layers 
 
 'Create a layer named ExampleLayer1 and add the shape to it. 
 Set vsoLayer = vsoLayers.Add("ExampleLayer1") 
 vsoLayer.Add vsoShape, 1 
 
 'Create a layer named ExampleLayer2 and add the shape to it. 
 Set vsoLayer = vsoLayers.Add("ExampleLayer2") 
 vsoLayer.Add vsoShape, 1 
 
 'Verify that the shape has been assigned to 2 layers. 
 Debug.Print "The shape is assigned to " & vsoShape.LayerCount & " layers." 
 
 'Get a reference to the first layer. 
 Set vsoLayer = vsoShape.Layer(1) 
 
 'Verify by using the Name property. 
 Debug.Print "Current layer name is """ & vsoLayer.Name & ".""" 
 
End Sub

Suporte e comentários

Tem dúvidas ou quer enviar comentários sobre o VBA para Office ou sobre esta documentação? Confira Suporte e comentários sobre o VBA para Office a fim de obter orientação sobre as maneiras pelas quais você pode receber suporte e fornecer comentários.