共用方式為


Layer.Page Visio) (屬性

取得包含圖層的頁面。 唯讀。

語法

expressionPage

表達 代表 Layer 物件的變數。

傳回值

頁面

註解

如果 Layer 物件是在主圖形而非頁面中,則 Page 屬性會傳回 Nothing。 您無法設定 Layer 物件的 Page 屬性。

範例

下列的 Microsoft Visual Basic for Applications (VBA) 巨集會示範如何使用 Page 屬性來傳回其他不同物件的 Page 物件。

Public Sub Page_Example() 
 
 Dim vsoPage1 As Visio.Page 
 Dim vsoPage2 As Visio.Page 
 Dim vsoTempPage As Visio.Page 
 Dim vsoLayer1 As Visio.Layer 
 Dim vsoLayer2 As Visio.Layer 
 Dim vsoLayers1 As Visio.Layers 
 Dim vsoLayers2 As Visio.Layers 
 
 'Set the current page name to MyPage1. 
 ActivePage.Name = "MyPage1" 
 
 'Use the Page property to return the current 
 'Page object from the Window object. 
 Set vsoPage1 = ActiveWindow.Page 
 
 'Verify that the expected page was received. 
 Debug.Print "The active window contains: " & vsoPage1.Name 
 
 'Add a second page named MyPage2. 
 Set vsoPage2 = ActiveDocument.Pages.Add 
 vsoPage2.Name = "MyPage2" 
 
 'Get the Layers collection from each page. 
 Set vsoLayers1 = vsoPage1.Layers 
 Set vsoLayers2 = vsoPage2.Layers 
 
 'Create a layer for each of the Layers collections. 
 Set vsoLayer1 = vsoLayers1.Add("ExampleLayer1") 
 Set vsoLayer2 = vsoLayers2.Add("ExampleLayer2") 
 
 'Use the Page property to return the Page object 
 'from a Layers object. 
 Set vsoTempPage = vsoLayers1.Page 
 
 'Verify that the expected page was received. 
 Debug.Print " vsoLayers1 is from: " & vsoTempPage.Name 
 
 'Use the Page property to return the Page object 
 'from a Layer object. 
 Set vsoTempPage = vsoLayer2.Page 
 
 'Verify that the expected page was received. 
 Debug.Print " vsoLayer2 is from: " & vsoTempPage.Name 
 
 'Set the active window's page to "MyPage1." 
 ActiveWindow.Page = "MyPage1" 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應