将新的 Layer 对象添加到 Layers 集合。
语法
表达式。添加 (LayerName)
表达 一个代表 Layers 对象的变量。
参数
名称 | 必需/可选 | 数据类型 | 说明 |
---|---|---|---|
LayerName | 必需 | 字符串 | 新图层的名称。 |
返回值
层
示例
以下宏显示如何将 Layer 对象添加到 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
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。