首页 > 代码库 > VBA学习笔记(8)-Application Object Members

VBA学习笔记(8)-Application Object Members

Application Object Members

Represents an instance of Microsoft Office Visio. An external program typically creates or retrieves an Application object before it can retrieve other Visio objects from that instance. Use the Microsoft Visual Basic CreateObject function or the New keyword to run a new instance, or use the GetObject function to retrieve an instance that is already running. You can also use the CreateObject function with the InvisibleApp object to run a new instance that is invisible. Set the value of the InvisibleApp object‘s Visible property to True to show it.

 

Methods

 

Name

Description

 

AddUndoUnit

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

 

BeginUndoScope

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

 

ClearCustomMenus

Restores the built-in Microsoft Office Visio menus.

 

ClearCustomToolbars

Restores the built-in Microsoft Visio toolbars.

 

ConvertResult

Converts a string or number into an equivalent number in different measurement units.

 

DoCmd

Performs the command that has the indicated command ID.

 

EndUndoScope

Ends or cancels a transaction that has a unique scope.

 

EnumDirectories

Returns an array naming the folders Microsoft Office Visio would search, given a list of paths.

 

FormatResult

Formats a string or number into a string according to a format picture. Uses specified units for scaling and formatting.

 

FormatResultEx

Formats a string or number into a string according to a format picture, using specified units for scaling and formatting. Optionally, for date or time strings, sets the language and calendar type of the string.

 

InvokeHelp

Performs operations that involve the Microsoft Office Visio Help system.

 

OnComponentEnterState

Informs a Microsoft Office Visio instance that client code is causing the instance to enter or exit a particular state.

 

PurgeUndo

Empties the Microsoft Office Visio queue of undo actions.

 

QueueMarkerEvent

Queues a MarkerEvent event that fires after all other queued events.

 

Quit

Closes the indicated instance of Microsoft Office Visio.

 

Redo

Reverses the most recent undo unit.

 

RenameCurrentScope

Renames the top-level open undo scope.

 

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.

 

Undo

Reverses the most recent undo unit, if the undo unit can be reversed.

 

Properties

 

Name

Description

 

Active

Indicates whether the instance of Microsoft Office Visio represented by the Application object is the active application on the Microsoft Windows desktop—the application that has the highlighted title bar. Read-only.

 

ActiveDocument

Returns the active Document object, which is the document shown in the active window. Read-only.

 

ActivePage

Returns the active Page object. Read-only.

 

ActivePrinter

Specifies the printer that all Microsoft Office Visio documents print to. Read/write.

 

ActiveWindow

Returns the active Window object. Read-only.

 

AddonPaths

Gets or sets the paths where Microsoft Office Visio looks for third-party or user add-ons. Read/write.

 

Addons

Returns the Addons collection of an Application or InvisibleApp object. Read-only.

 

AlertResponse

Determines whether Microsoft Office Visio shows alerts and modal dialog boxes to the user. Read/write.

 

Application

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

 

Assistance

Gets a reference to the Microsoft Office (MSO) IAssistance object, which provides a means for developers to create a customized help experience for users within Microsoft Office. Read-only.

 

AutoLayout

Allows you to temporarily disable automatic layout functionality in Microsoft Office Visio and then re-enable it after you are finished with an action. Read/write.

 

AutoRecoverInterval

Represents the time interval (in minutes) for how often you want to save copies of open documents that have unsaved changes in case of a power failure or an application error. Read/write.

 

AvailablePrinters

Returns a list of installed printers. Read-only.

 

Build

Returns the build number of the running instance. Read-only.

 

BuiltInMenus

Returns a UIObject object that represents a copy of the built-in Microsoft Office Visio menus and accelerators. Read-only.

 

BuiltInToolbars

Returns a UIObject object that represents a copy of the built-in Microsoft Office Visio toolbars. Read-only.

 

COMAddIns

Returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently registered in Microsoft Office Visio. Read-only.

 

CommandBars

Returns a reference to the CommandBars collection that represents the command bars in the container application. Read-only.

 

CommandLine

Determines how Microsoft Office Visio was started. Read-only.

 

ConnectorToolDataObject

Returns an IDataObject interface representing the active Connector tool used in the Microsoft Office Visio user interface. Read-only.

 

CurrentScope

Determines the ID of the scope that causes an event to fire. Read-only.

 

CustomMenus

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

 

CustomMenusFile

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

 

CustomToolbars

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

 

CustomToolbarsFile

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

 

DataFeaturesEnabled

Gets whether the data features in Microsoft Office Visio 2007 are enabled for the current instance of Visio. Read-only.

 

DefaultAngleUnits

Determines the default unit of measure for quantities that represent angles. Read/write.

 

DefaultDurationUnits

Determines the default unit of measure for quantities that represent durations. Read/write.

 

DefaultRectangleDataObject

Returns an IDataObject interface that represents the Rectangle tool used in the Microsoft Office Visio user interface. Read-only.

 

DefaultTextUnits

Determines the default unit of measure for quantities that represent text metrics. Read/write.

 

DefaultZoomBehavior

Determines the zoom behavior for all new Microsoft Office Visio documents and drawing windows. Read/write.

 

DeferRecalc

Determines whether the application recalculates cell formulas during a series of actions. Read/write.

 

DialogFont

Returns information about the fonts that Microsoft Office Visio uses in its dialog boxes. Read-only.

 

Documents

Returns the Documents collection for a Microsoft Office Visio instance. Read-only.

 

DrawingPaths

Gets or sets the paths where Microsoft Office Visio looks for drawings. Read/write.

 

EventInfo

Gets additional information associated with an event, if any exists. Read-only.

 

EventList

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

 

EventsEnabled

Determines whether a Microsoft Office Visio instance fires events. Read/write.

 

FullBuild

Returns the full build number of the running instance. Read-only.

 

HelpPaths

Gets or sets the paths where Microsoft Office Visio looks for Help files. Read/write.

 

InhibitSelectChange

Determines whether shapes added to the drawing page by Automation are selected. Read/write.

 

InstanceHandle32

Gets the instance handle of the Application object for a 32-bit version of Microsoft Office Visio. Read-only.

 

IsInScope

Determines whether a call to an event handler is between an EnterScope event and an ExitScope event for a scope. Read-only.

 

IsUndoingOrRedoing

Determines whether the current event handler is being called as a result of an Undo or Redo action in the application. Read-only.

 

Language

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

 

LanguageHelp

Represents the language ID of the Help in the version of the Microsoft Office Visio instance represented by the parent object. Read-only.

 

LanguageSettings

Returns a reference to the Microsoft Office (MSO) LanguageSettings interface. Read-only.

 

LiveDynamics

Controls whether Microsoft Office Visio recalculates shape properties during drag operations on every mouse move or only after the mouse button is released. Read/write.

 

MyShapesPath

Gets or sets the path to the My Shapes folder on the user‘s hard drive. Read/write.

 

Name

Specifies the name of an object. Read-only.

 

ObjectType

Returns an object‘s type. Read-only.

 

OnDataChangeDelay

Gets or sets how long the Microsoft Office Visio instance waits before advising a container application that a Visio document being shown by the container has changed and should be redisplayed. Read/write.

 

Path

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

 

PersistsEvents

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

 

ProcessID

Returns a unique process ID for a Microsoft Office Visio instance. Read-only.

 

PromptForSummary

Determines whether Microsoft Office Visio prompts for document properties when it saves a document. Read/write.

 

SaveAsWebObject

Returns a reference to the IDispatch interface of a VisSaveAsWeb object. Read-only.

 

ScreenUpdating

Determines whether the screen is updated (redrawn) during a series of actions. Read/write.

 

Settings

Returns an ApplicationSettings object, which you can use to set Microsoft Office Visio application properties. Read-only.

 

ShowChanges

Determines whether the screen is updated (redrawn) during a series of actions. Read/write.

 

ShowProgress

Determines whether a progress indicator is shown while performing certain operations. Read/write.

 

ShowStatusBar

Determines whether a status bar is shown. Read/write.

 

ShowToolbar

Determines whether toolbars and menu bars are visible. Read/write.

 

StartupPaths

Gets or sets the paths where Microsoft Office Visio looks for third-party and user add-ons to run when the application is started. Read/write.

 

Stat

Returns status information for an object. Read-only.

 

StencilPaths

Gets or sets the paths where Microsoft Office Visio looks for stencils. Read/write.

 

TemplatePaths

Gets or sets the paths where Microsoft Office Visio looks for templates. Read/write.

 

TraceFlags

Gets or sets events logged during a Microsoft Office Visio instance. Read/write.

 

TypelibMajorVersion

Returns the major version number of the Visio type library. Read-only.

 

TypelibMinorVersion

Returns the minor version number of the Visio type library. Read-only.

 

UndoEnabled

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

 

UserName

Gets or sets the user name of an Application object. Read/write.

 

VBAEnabled

Specifies whether Microsoft Visual Basic for Applications (VBA) is enabled in the application. Read-only.

 

Vbe

Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Office Visio documents. Read-only.

 

Version

Returns the version of a running Microsoft Office Visio instance. Read-only.

 

Visible

Determines whether an object is visible. Read/write.

 

Window

Returns the window associated with the current instance of Microsoft Office Visio. Read-only.

 

WindowHandle32

Returns the 32-bit handle of a Microsoft Office Visio window. Read-only.

 

Windows

Returns the Windows collection for a Microsoft Office Visio instance or window. Read-only.

 

Events

 

Name

Description

 

AfterModal

Occurs after the Microsoft Office Visio instance leaves a modal state.

 

AfterRemoveHiddenInformation

Occurs when hidden information is removed from the document.

 

AfterResume

Occurs when the operating system resumes normal operation after having been suspended.

 

AfterResumeEvents

Occurs after firing of events is resumed.

 

AppActivated

Occurs after a Microsoft Office Visio instance becomes active.

 

AppDeactivated

Occurs after a Microsoft Office Visio instance becomes inactive.

 

AppObjActivated

Occurs after a Microsoft Office Visio instance becomes active.

 

AppObjDeactivated

Occurs after a Microsoft Office Visio instance becomes inactive.

 

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.

 

BeforeModal

Occurs before a Microsoft Office Visio instance enters a modal state.

 

BeforePageDelete

Occurs before a page is deleted.

 

BeforeQuit

Occurs before a Microsoft Office Visio instance terminates.

 

BeforeSelectionDelete

Occurs before selected objects are deleted.

 

BeforeShapeDelete

Occurs before a shape is deleted.

 

BeforeShapeTextEdit

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

 

BeforeStyleDelete

Occurs before a style is deleted.

 

BeforeSuspend

Occurs before the operating system enters a suspended state.

 

BeforeSuspendEvents

Occurs before firing of events is suspended.

 

BeforeWindowClosed

Occurs before a window is closed.

 

BeforeWindowPageTurn

Occurs before a window is about to show a different page.

 

BeforeWindowSelDelete

Occurs before the shapes in the selection of a window are deleted.

 

CellChanged

Occurs after the value changes in a cell in a document.

 

ConnectionsAdded

Occurs after connections have been established between shapes.

 

ConnectionsDeleted

Occurs after connections between shapes have been removed.

 

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.

 

DataRecordsetChanged

Occurs when a data recordset changes as a result of being refreshed.

 

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.

 

EnterScope

Queued when an internal command begins, or when an Automation client opens a scope by using the BeginUndoScope method.

 

ExitScope

Queued when an internal command ends, or when an Automation client exits a scope using the EndUndoScope method.

 

FormulaChanged

Occurs after a formula changes in a cell in the object that receives the event.

 

GroupCanceled

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

 

KeyDown

Occurs when a keyboard key is pressed.

 

KeyPress

Occurs when a keyboard key is pressed.

 

KeyUp

Occurs when a keyboard key is released.

 

MarkerEvent

Caused by calling the QueueMarkerEvent method.

 

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.

 

MouseDown

Occurs when a mouse button is clicked.

 

MouseMove

Occurs when the mouse is moved.

 

MouseUp

Occurs when a mouse button is released.

 

MustFlushScopeBeginning

Occurs before the Microsoft Office Visio instance is forced to flush its event queue.

 

MustFlushScopeEnded

Occurs after the Microsoft Office Visio instance forces a flush of its event queue.

 

NoEventsPending

Occurs after the Microsoft Ofice Visio instance flushes its event queue.

 

OnKeystrokeMessageForAddon

Occurs when Microsoft Office Visio receives a keystroke message from Microsoft Windows that is targeted at an add-on window or child of an add-on window.

 

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.

 

QueryCancelQuit

Occurs before the application terminates 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.

 

QueryCancelSuspend

Occurs before the operating system enters a suspended state. If any event handler returns True, the Microsoft Office Visio instance will deny the operating system‘s request.

 

QueryCancelSuspendEvents

Occurs before the application suspends events in response to client code. 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.

 

QueryCancelWindowClose

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

 

QuitCanceled

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

 

RunModeEntered

Occurs after a document enters run mode.

 

SelectionAdded

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

 

SelectionChanged

Occurs after a set of shapes selected in a window changes.

 

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.

 

ShapeChanged

Occurs after a property of a shape that is not stored in a cell is changed in 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.

 

ShapeLinkAdded

Occurs after a shape is linked to a data row.

 

ShapeLinkDeleted

Occurs after the link between a shape and a data row is deleted.

 

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.

 

SuspendCanceled

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

 

SuspendEventsCanceled

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

 

TextChanged

Occurs after the text of a shape is changed in a document.

 

UngroupCanceled

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

 

ViewChanged

Occurs when the zoom level or scroll position of a drawing window changes.

 

VisioIsIdle

Occurs after the application empties its message queue.

 

WindowActivated

Occurs after the active window changes in a Microsoft Office Visio instance.

 

WindowChanged

Occurs when the size or position of a window changes.

 

WindowCloseCanceled

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

 

WindowOpened

Occurs after a window is opened.

 

WindowTurnedToPage

Occurs after a window shows a different page.

VBA学习笔记(8)-Application Object Members