propiedad Layer.Name (Visio)
Especifica el nombre de un objeto. Solo lectura.
Sintaxis
expresión. Nombre
Expresión Variable que representa un objeto Layer .
Valor devuelto
Cadena
Comentarios
Nota:
A partir de Microsoft Visio 2000, puede usar nombres locales y universales para hacer referencia a formas, patrones, documentos, páginas, filas, complementos, celdas, hipervínculos, estilos, fuentes, accesos directos maestros, objetos de interfaz de usuario y capas de Visio. Cuando un usuario asigna un nombre a una forma, por ejemplo, el usuario especifica un nombre local. A partir de Microsoft Office Visio 2003, la hoja de cálculo ShapeSheet solo muestra nombres universales en fórmulas y valores de celda. (En versiones anteriores, los nombres universales no eran visibles en la interfaz de usuario).
Como programador, puede usar nombres universales en un programa cuando no desee cambiar un nombre cada vez que localice una solución. Use la propiedad Name para obtener o establecer el nombre local de los objetos Hyperlink, Layer, Master, MasterShortcut, Page, Shape, Style o Row. Para obtener o establecer su nombre universal utilice la propiedad NameU.
Ejemplo:
Esta macro de Microsoft Visual Basic para Aplicaciones (VBA) muestra cómo utilizar la propiedad Name para mostrar los nombres de las capas. También utiliza la propiedad Layer para obtener una referencia a una determinada capa y la propiedad LayerCount para determinar el número de capas a las que está asignada una forma.
Public Sub Name_Example()
Dim vsoPage As Visio.Page
Dim vsoShape As Visio.Shape
Dim vsoLayers As Visio.Layers
Dim vsoLayer As Visio.Layer
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 page has " & vsoShape.LayerCount & " layers."
'Get a reference to the first layer.
Set vsoLayer = vsoShape.Layer(1)
'Verify by using the Name property.
Debug.Print "Current vsoLayer name is """ & vsoLayer.Name & "."""
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.
Comentarios
https://aka.ms/ContentUserFeedback.
Próximamente: A lo largo de 2024 iremos eliminando gradualmente GitHub Issues como mecanismo de comentarios sobre el contenido y lo sustituiremos por un nuevo sistema de comentarios. Para más información, vea:Enviar y ver comentarios de