Document Members (Visio)

GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Represents a drawing file (.vsd or .vdx), stencil file (.vss or .vsx), or template file (.vst or .vtx) that is open in an instance of Microsoft Visio. A Document object is a member of the Documents collection of an Application object.

Events

Name

Description

AfterDocumentMerge

Occurs when Visio incorporates changes from other users? versions of a document into a merged, co-authored document.

AfterRemoveHiddenInformation

Occurs when hidden information is removed from the document.

BeforeDataRecordsetDelete

Occurs before a DataRecordset object is deleted from the DataRecordsets collection.

BeforeDocumentClose

Occurs before a document is closed.

BeforeDocumentSave

Occurs before a document is saved.

BeforeDocumentSaveAs

Occurs just before a document is saved by using the Save As command.

BeforeMasterDelete

Occurs before a master is deleted from a document.

BeforePageDelete

Occurs before a page is deleted.

BeforeSelectionDelete

Occurs before selected objects are deleted.

BeforeShapeTextEdit

Occurs before a shape is opened for text editing in the user interface.

BeforeStyleDelete

Occurs before a style is deleted.

ConvertToGroupCanceled

Occurs after an event handler has returned True (cancel) to a QueryCancelConvertToGroup event.

DataRecordsetAdded

Occurs when a DataRecordset object is added to a DataRecordsets collection.

DesignModeEntered

Occurs before a document enters design mode.

DocumentChanged

Occurs after certain properties of a document are changed.

DocumentCloseCanceled

Occurs after an event handler has returned True (cancel) to a QueryCancelDocumentClose event.

DocumentCreated

Occurs after a document is created.

DocumentOpened

Occurs after a document is opened.

DocumentSaved

Occurs after a document is saved.

DocumentSavedAs

Occurs after a document is saved by using the Save As command.

GroupCanceled

Occurs after an event handler has returned True (cancel) to a QueryCancelGroup event.

MasterAdded

Occurs after a new master is added to a document.

MasterChanged

Occurs after properties of a master are changed and propagated to its instances.

MasterDeleteCanceled

Occurs after an event handler has returned True (cancel) to a QueryCancelMasterDelete event.

PageAdded

Occurs after a new page is added to a document.

PageChanged

Occurs after the name of a page, the background page associated with a page, or the page type (foreground or background) changes.

PageDeleteCanceled

Occurs after an event handler has returned True (cancel) to a QueryCancelPageDelete event.

QueryCancelConvertToGroup

Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. If any event handler returns True, the operation is canceled.

QueryCancelDocumentClose

Occurs before the application closes a document in response to a user action in the interface. If any event handler returns True, the operation is canceled.

QueryCancelGroup

Occurs before the application groups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

QueryCancelMasterDelete

Occurs before the application deletes a master in response to a user action in the interface. If any event handler returns True, the operation is canceled.

QueryCancelPageDelete

Occurs before the application deletes a page in response to a user action in the interface. If any event handler returns True, the operation is canceled.

QueryCancelSelectionDelete

Occurs before the application deletes a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

QueryCancelStyleDelete

Occurs before the application deletes a style in response to a user action in the interface. If any event handler returns True, the operation is canceled.

QueryCancelUngroup

Occurs before the application ungroups a selection of shapes in response to a user action in the interface. If any event handler returns True, the operation is canceled.

RuleSetValidated

Occurs when a rule set is validated.

RunModeEntered

Occurs after a document enters run mode.

SelectionDeleteCanceled

Occurs after an event handler has returned True (cancel) to a QueryCancelSelectionDelete event.

ShapeAdded

Occurs after one or more shapes are added to a document.

ShapeDataGraphicChanged

Occurs after a data graphic is applied to or deleted from a shape.

ShapeExitedTextEdit

Occurs after a shape is no longer open for interactive text editing.

ShapeParentChanged

Occurs after shapes are grouped or a group is ungrouped.

StyleAdded

Occurs after a new style is added to a document.

StyleChanged

Occurs after the name of a style is changed or a change to the style propagates to objects to which the style is applied.

StyleDeleteCanceled

Occurs after an event handler has returned True (cancel) to a QueryCancelStyleDelete event.

UngroupCanceled

Occurs after an event handler has returned True (cancel) to a QueryCancelUngroup event.

Methods

Name

Description

AddUndoUnit

Adds an object that supports the IOleUndoUnit or IVBUndoUnit interface to the Microsoft Visio undo queue.

BeginUndoScope

Starts a transaction with a unique scope ID for an instance of Microsoft Visio.

CanCheckIn

Specifies whether a document can be checked into a Microsoft SharePoint Server computer.

CanUndoCheckOut

Determines whether a Microsoft Visio document is checked out from a Microsoft SharePoint Server site, so that if it is, the check-out can be subsequently undone.

CheckIn

Returns a document from a local computer to a Microsoft SharePoint Server computer.

Clean

Examines, reports, and repairs selected conditions in a document.

ClearCustomMenus

Restores the built-in Microsoft Visio user interface.

ClearCustomToolbars

Restores the built-in Microsoft Visio user interface.

ClearGestureFormatSheet

Clears local formatting in a document's Gesture Format sheet.

Close

Closes a document.

CopyPreviewPicture

Copies the preview picture from another document into the current document.

DeleteSolutionXMLElement

Deletes the named SolutionXML element.

Drop

Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.

EndUndoScope

Ends or cancels a transaction that has a unique scope.

ExecuteLine

Executes a line of Microsoft Visual Basic code.

ExportAsFixedFormat

Exports a Microsoft Visio document as a file in a fixed format, either PDF or XPS.

FollowHyperlink

Navigates to an arbitrary hyperlink.

GetThemeNames

Returns a locale-specific array of names of themes contained in the document.

GetThemeNamesU

Returns a locale-independent array of names of themes contained in the document.

OpenStencilWindow

Opens a stencil window that shows the masters in the document.

ParseLine

Parses a line of Microsoft Visual Basic code.

Print

Prints the contents of an object to the default printer.

PrintOut

Prints the contents of the active document and provides various printing options.

PurgeUndo

Empties the Microsoft Visio queue of undo actions.

RemoveHiddenInformation

Removes hidden information, such as personal information and external data, from a Microsoft Visio document.

RenameCurrentScope

Renames the top-level open undo scope.

Save

Saves a document.

SaveAs

Saves a document and gives it a file name.

SaveAsEx

Saves a document with a file name using extra information passed in an argument.

SetCustomMenus

Replaces the current built-in or custom menus of an application or document.

SetCustomToolbars

Replaces the current built-in or custom toolbars of an application or document.

UndoCheckOut

Closes a Microsoft Visio document checked out from a Microsoft SharePoint Server site, deletes the local copy of the document, discarding any changes, undoes the checkout, and then reopens the document.

Properties

Name

Description

AlternateNames

Gets or sets the alternate names for a document. Read/write.

Application

Returns the instance of Microsoft Visio that is associated with an object. Read-only.

AutoRecover

Determines whether an open document that has unsaved changes is copied when automatic recovery is enabled. Read/write.

BottomMargin

Specifies the bottom margin when printing the pages in a document. Read/write.

BuildNumberCreated

Returns the build number of the instance used to create the document. Read-only.

BuildNumberEdited

Returns the build number of the instance last used to edit the document. Read-only.

Category

Gets or sets the value of a document's category, one of the document properties. Read/write.

ClassID

Returns the class ID string of the container application in which the document is embedded. Read-only.

Colors

Returns the Colors collection of a Document object. Read-only.

Comments

Returns a Comments object that represents the collection of all the reviewer comments in the document. Read-only.

Company

Gets or sets the name of the company the document belongs to, one of the document's properties. Read/write.

CompatibilityMode

Returns a Boolean that indicates whether the specified document is in compatibility mode. Read-only.

Container

Returns an IDispatch interface on the ActiveX container in which the document is contained or Nothing if the document is not in a container. Read-only.

ContainsWorkspaceEx

Gets or sets whether workspace information is saved with the document. Read/write.

Creator

Gets or sets the value of a document's author—one of the document's properties. Read/write.

CustomMenus

Gets a UIObject object that represents the current custom menus and accelerators of a Document object. Read-only.

CustomMenusFile

Gets or sets the name of the file that defines custom menus and accelerators for a Document object. Read/write.

CustomToolbars

Gets a UIObject object that represents the current custom toolbars and status bars of a Document object. Read-only.

CustomToolbarsFile

Returns or sets the name of the file that defines custom toolbars and status bars for a Document object. Read/write.

CustomUI

Gets or sets the Ribbon XML string that is passed to the document to customize the Microsoft Office Fluent user interface. Read/write.

DataRecordsets

Returns the DataRecordsets collection contained in the document. Read-only.

DefaultFillStyle

Gets or sets the default fill style of a document. Read/write.

DefaultGuideStyle

Gets or sets the default guide style of a document. Read/write.

DefaultLineStyle

Gets or sets the default line style of a document. Read/write.

DefaultSavePath

Gets or sets the path to the location where Microsoft Visio saves the current document by default. Read/write.

DefaultStyle

Gets the default fill style of a document or sets the default fill, line, and text styles of a document. Read/write.

DefaultTextStyle

Gets or sets the default text style of a document. Read/write.

Description

Gets or sets the description of a document, one of a document's properties. Read/write.

DiagramServicesEnabled

Determines which, if any, diagram services are enabled for the document. Read/write.

DocumentSheet

Returns a Shape object whose cells represent properties of the document. Read-only.

DynamicGridEnabled

Determines whether the dynamic grid is enabled. Read/write.

EditorCount

Returns a Long that represents the number of editors of a co-authored document. Read-only.

EmailRoutingData

Returns e-mail routing data for a document. Read-only.

EventList

Returns the EventList collection of an object or the EventList collection that contains an Event object. Read-only.

Fonts

Returns the Fonts collection of a Document object. Read-only.

FooterCenter

Gets or sets the text string that appears in the center portion of a document's footer. Read/write.

FooterLeft

Gets or sets the text string that appears on the left side of a document's footer. Read/write.

FooterMargin

Gets or sets the margin of a document's footer. Read/write.

FooterRight

Gets or sets the text string that appears in the right portion of a document's footer. Read/write.

FullBuildNumberCreated

Returns the full build number of the instance used to create the document. Read-only.

FullBuildNumberEdited

Returns the full build number of the instance last used to edit the document. Read-only.

FullName

Returns the name of a document, including the drive and path. Read-only.

GestureFormatSheet

Returns a reference to a document's Gesture Format sheet, which contains the line, fill, and text formatting that is applied to shapes drawn on the page. Read-only.

GlueEnabled

Determines whether glue is enabled in the document. Read/write.

GlueSettings

Determines the objects that shapes glue to when glue is enabled in the document. Read/write.

HeaderCenter

Contains the text string that appears in the center portion of a document's header. Read/write.

HeaderFooterColor

Specifies the color of the header and footer text. Read/write.

HeaderFooterFont

Specifies the font used for the header and footer text. Read/write.

HeaderLeft

Gets or sets the text string that appears in the left portion of a document's header. Read/write.

HeaderMargin

Gets or sets the margin of a document's header. Read/write.

HeaderRight

Gets or sets the text string that appears in the right portion of a document's header. Read/write.

HyperlinkBase

Gets or sets the value of the Hyperlink base box in a document's Properties dialog box (click the File tab, click Info, click Properties, and then click Advanced Properties). Read/write.

ID

Gets the ID of an object. Read-only.

Index

Gets the ordinal position of a Document object in the Documents collection. Read-only.

InPlace

Specifies whether a document is open in place, or whether a document is being viewed through a window that is open in place. Read-only.

Keywords

Gets or sets the value of the Keywords box in a document's Properties dialog box. Read/write.

Language

Represents the language ID of the version of the Microsoft Visio instance represented by the parent object. Read/write.

LeftMargin

Specifies the left margin, which is used when printing. Read/write.

MacrosEnabled

Specifies whether you can execute macros and process events in a document's Microsoft Visual Basic for Applications (VBA) project. Read-only.

Manager

Gets or sets the value of the Manager box in a document's Properties dialog box. Read/write.

Masters

Returns the Masters collection for a document's stencil. Read-only.

MasterShortcuts

Returns the MasterShortcuts collection for a document stencil. Read-only.

Mode

Determines whether a document is in run mode or design mode. Read/write.

Name

Specifies the name of an object. Read-only.

ObjectType

Returns an object's type. Read-only.

OLEObjects

Returns the OLEObjects collection of a document. Read-only.

Pages

Returns the Pages collection for a document. Read-only.

PaperHeight

Returns the height of a document's printed page. Read-only.

PaperSize

Gets or sets the paper size of a document. Read/write.

PaperWidth

Returns the width of a document's printed page. Read-only.

Path

Returns the drive and folder path of the Microsoft Visio document. Read-only.

PersistsEvents

Indicates whether an object is capable of containing persistent events in its EventList collection. Read-only.

PreviewPicture

Gets or sets the preview picture shown in the Open dialog box and when you click the File tab, and then click New. Read/write.

PrintCenteredH

Indicates whether drawings are centered between the left and right edges of the paper when printed. Read/write.

PrintCenteredV

Indicates whether drawings are centered between the top and bottom edges of the paper when printed. Read/write.

Printer

Specifies the name of the printer to use when printing the document. Read/write.

PrintFitOnPages

Indicates whether drawings in a document are printed on a specified number of sheets across and down. Read/write.

PrintLandscape

Indicates whether a document's drawings are printed in landscape or portrait orientation. Read/write.

PrintPagesAcross

Indicates the number of sheets of paper on which a drawing is printed horizontally. Read/write.

PrintPagesDown

Gets or sets the number of sheets of paper on which a drawing is printed vertically. Read/write.

PrintScale

Gets or sets how much drawings are reduced or enlarged when printed. Read/write.

ProgID

Returns the programmatic identifier of a shape that represents an ActiveX control, an embedded object, or linked object. Read-only.

Protection

Determines how a document is protected from user customization. Read/write.

ReadOnly

Indicates whether a file is open as read-only. Read-only.

RemovePersonalInformation

Determines if personal information about a file is saved when the user saves the file in Microsoft Visio. Read/write.

RightMargin

Specifies the right margin, which is used when printing. Read/write.

Saved

Indicates whether a document has any unsaved changes. Read/write.

SavePreviewMode

Determines whether and how a preview picture is saved in a file. Read/write.

ServerPublishOptions

Returns a ServerPublishOptions object that you can use to specify the settings to apply when you save a document as a Web drawing (as a .vdw file), then publish and use it on a Microsoft SharePoint site in conjunction with Visio Services. Read-only.

SharedWorkspace

Returns a Microsoft Office SharedWorkspace object that provides access to the Office Document Workspace object model. Read-only.

SnapAngles

Determines the degree of the angle that is drawn when isometric angle lines is chosen as a shape extension option. Read/write.

SnapEnabled

Determines whether snap is active in the document. Read/write.

SnapExtensions

Determines the shape extensions that are active in a document. Read/write.

SnapSettings

Determines the objects that shapes snap to when snap is active in the document. Read/write.

SolutionXMLElement

Contains solution-specific, well-formed XML data stored with a document. Read/write.

SolutionXMLElementCount

Returns the number of SolutionXML elements in a document. Read-only.

SolutionXMLElementExists

Indicates whether a named SolutionXML element exists in the document. Read-only.

SolutionXMLElementName

Returns the name of the SolutionXML element. Read-only.

Stat

Returns status information for an object. Read-only.

Styles

Returns the Styles collection for a document. Read-only.

Subject

Gets or sets the value of the Subject field in a document's properties. Read/write.

Sync

Returns a Microsoft Office Sync object that provides information about the status of the active document in a shared workspace and the ability to perform a set of actions. Read-only.

Template

Returns the name of the template from which the document was created. Read-only.

Time

Returns the most recently recorded date and time. Read-only.

TimeCreated

Returns the date and time the document was created. Read-only.

TimeEdited

Returns the date and time the document was last edited. Read-only.

TimePrinted

Returns the date and time the document was last printed. Read-only.

TimeSaved

Returns the date and time the document was last saved. Read-only.

Title

Gets or sets the value of the Title field in a document's properties. Read/write.

TopMargin

Specifies the top margin when printing a document. Read/write.

Type

Returns the type of the Document object. Read-only.

UndoEnabled

Determines whether undo information is maintained in memory. Read/write.

UserCustomUI

Gets or sets the Ribbon XML string that is passed to the document to customize the Quick Access toolbar or the Ribbon. Read/write.

Validation

Returns the Validation object that is associated with the document. Read-only.

VBProject

Returns an automation object that you can use to control the Microsoft Visual Basic for Applications (VBA) project of the document. Read-only.

VBProjectData

Returns the Microsoft Visual Basic project data stored with a document. Read-only.

Version

Gets the version of a saved document or sets the version in which to save a document. Read/write.

ZoomBehavior

Determines the zoom behavior for a Microsoft Visio document or window. Read/write.

Permission

Returns the Permission object of the document.