代表繪圖檔案 (.vsd 或 .vdx) 、模板檔 (.vss 或 .vsx) ,或範本檔案 (.vst 或 .vtx) ,且在 Microsoft Visio 實例中已開啟。 文件物件是應用程式物件文件集合的成員。
註解
Document 物件的預設屬性為 Name。
使用 Documents collection 的 Open 方法來開啟現有文件。
使用文件收藏的新增方法來建立新文件。
使用 Application 物件的 ActiveDocument 屬性來取得實例中的活動文件。
使用 Pages、 Masters 和 Styles 屬性分別取得 Page、 Master 和 Style 物件。
請使用 CustomMenu 或 CustomToolbars 屬性來存取自訂選單或工具列。
注意事項
每個 Visio 文件的 Microsoft Visual Basic for Applications (VBA) 專案也有一個名為 ThisDocument 的類別模組。 當你在 VBA 專案中從程式碼中引用 ThisDocument 模組時,它會回傳一個指向專案 文件物件的 參考。 例如,文件專案中的程式碼可以在 訊息 框中顯示該專案文件名稱,並搭配以下語句:
MsgBox ThisDocument.Name
如果您的 Visual Studio 解決方案包含 Microsoft.Office.Interop.Visio 參考,該物件會對應以下類型:
- Microsoft.Office.Interop.Visio.IVDocument
事件
- AfterDocumentMerge
- AfterRemoveHiddenInformation
- BeforeDataRecordsetDelete
- BeforeDocumentClose
- BeforeDocumentSave
- BeforeDocumentSaveAs
- BeforeMasterDelete
- BeforePageDelete
- BeforeSelectionDelete
- BeforeShapeTextEdit
- BeforeStyleDelete
- ConvertToGroupCanceled
- DataRecordsetAdded
- DesignModeEntered
- DocumentChanged
- DocumentCloseCanceled
- DocumentCreated
- DocumentOpened
- DocumentSaved
- DocumentSavedAs
- GroupCanceled
- MasterAdded
- MasterChanged
- MasterDeleteCanceled
- PageAdded
- PageChanged
- PageDeleteCanceled
- QueryCancelConvertToGroup
- QueryCancelDocumentClose
- QueryCancelGroup
- QueryCancelMasterDelete
- QueryCancelPageDelete
- QueryCancelSelectionDelete
- QueryCancelStyleDelete
- QueryCancelUngroup
- RuleSetValidated
- RunModeEntered
- SelectionDeleteCanceled
- ShapeAdded
- ShapeDataGraphicChanged
- ShapeExitedTextEdit
- ShapeParentChanged
- StyleAdded
- StyleChanged
- StyleDeleteCanceled
- UngroupCanceled
方法
- AddUndoUnit
- BeginUndoScope
- CanCheckIn
- CanUndoCheckOut
- CheckIn
- Clean
- ClearCustomMenus
- ClearCustomToolbars
- ClearGestureFormatSheet
- Close
- CopyPreviewPicture
- DeleteSolutionXMLElement
- Drop
- EndUndoScope
- ExecuteLine
- ExportAsFixedFormat
- FollowHyperlink
- GetThemeNames
- GetThemeNamesU
- OpenStencilWindow
- ParseLine
- PrintOut
- PurgeUndo
- RemoveHiddenInformation
- RenameCurrentScope
- Save
- SaveAs
- SaveAsEx
- SetCustomMenus
- SetCustomToolbars
- UndoCheckOut
屬性
- AlternateNames
- Application
- AutoRecover
- BottomMargin
- BuildNumberCreated
- BuildNumberEdited
- Category
- ClassID
- Colors
- Comments
- Company
- CompatibilityMode
- Container
- ContainsWorkspaceEx
- Creator
- CustomMenus
- CustomMenusFile
- CustomToolbars
- CustomToolbarsFile
- CustomUI
- DataRecordsets
- DefaultFillStyle
- DefaultGuideStyle
- DefaultLineStyle
- DefaultSavePath
- DefaultStyle
- DefaultTextStyle
- Description
- DiagramServicesEnabled
- DocumentSheet
- DynamicGridEnabled
- EditorCount
- EmailRoutingData
- EventList
- Fonts
- FooterCenter
- FooterLeft
- FooterMargin
- FooterRight
- FullBuildNumberCreated
- FullBuildNumberEdited
- FullName
- GestureFormatSheet
- GlueEnabled
- GlueSettings
- HeaderCenter
- HeaderFooterColor
- HeaderFooterFont
- HeaderLeft
- HeaderMargin
- HeaderRight
- HyperlinkBase
- ID
- Index
- InPlace
- Keywords
- Language
- LeftMargin
- MacrosEnabled
- Manager
- Masters
- MasterShortcuts
- Mode
- Name
- ObjectType
- OLEObjects
- Pages
- PaperHeight
- PaperSize
- PaperWidth
- Path
- Permission
- PersistsEvents
- PreviewPicture
- PrintCenteredH
- PrintCenteredV
- Printer
- PrintFitOnPages
- PrintLandscape
- PrintPagesAcross
- PrintPagesDown
- PrintScale
- ProgID
- Protection
- ReadOnly
- RemovePersonalInformation
- RightMargin
- Saved
- SavePreviewMode
- ServerPublishOptions
- SharedWorkspace
- SnapAngles
- SnapEnabled
- SnapExtensions
- SnapSettings
- SolutionXMLElement
- SolutionXMLElementCount
- SolutionXMLElementExists
- SolutionXMLElementName
- Stat
- Styles
- Subject
- Sync
- Template
- Time
- TimeCreated
- TimeEdited
- TimePrinted
- TimeSaved
- Title
- TopMargin
- Type
- UndoEnabled
- UserCustomUI
- Validation
- VBProject
- VBProjectData
- Version
- ZoomBehavior
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。