Свойство Page.Document (Visio)
Возвращает объект Document , связанный с объектом . Только для чтения.
Синтаксис
expression. Документа
Выражение Переменная, представляющая объект Page .
Возвращаемое значение
Документ
Замечания
Если решение Visual Studio содержит ссылку microsoft.Office.Interop.Visio , это свойство сопоставляется со следующими типами:
- Microsoft.Office.Interop.Visio.IVPage.Document
Пример
В следующем макросе Microsoft Visual Basic для приложений (VBA) показано, как использовать свойство Document для различных объектов для получения данных об этих объектах, и выполняет следующие действия:
Он добавляет объект Document в коллекцию Documents и задает несколько свойств объекта Document .
Он получает активное окно и активную страницу, рисует прямоугольник на странице и удаляет главный объект в объект Document , чтобы предоставить различные объекты для работы.
Он использует свойство Document для получения объекта Document , связанного с каждым из этих других объектов.
Public Sub Document_Example()
Dim vsoDocument As Visio.Document
Dim vsoTempDocument As Visio.Document
Dim vsoPage As Visio.Page
Dim vsoShape As Visio.Shape
Dim vsoWindow As Visio.Window
Dim vsoMaster As Visio.Master
'Add a document to the Documents collection.
Set vsoDocument = Documents.Add("")
'Set the title of the document.
vsoDocument.Title = "My Document"
'Get the active window and active page.
Set vsoWindow = ActiveWindow
Set vsoPage = ActivePage
'Draw a rectangle on the page.
Set vsoShape = vsoPage.DrawRectangle(2, 2, 5, 5)
'Add a master.
Set vsoMaster = vsoDocument.Masters.Add
'Get the Document object associated with various other objects.'Get the Document object associated with the Window object.
Set vsoTempDocument = vsoWindow.Document
'Get the Title property of the Document object to verify that this is the same document we added earlier.
Debug.Print vsoTempDocument.Title
'Get the Document object associated with the Page object.
Set vsoTempDocument = vsoPage.Document
Debug.Print vsoTempDocument.Title
'Get the Document object associated with the Shape object.
Set vsoTempDocument = vsoShape.Document
Debug.Print vsoTempDocument.Title
'Get the Document object associated with the Master object.
Set vsoTempDocument = vsoMaster.Document
Debug.Print vsoTempDocument.Title
End Sub
Поддержка и обратная связь
Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь.