Layers.Add 方法 (Visio)
會將新的 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 支援與意見反應。