Document.Mode Property
Visio Automation Reference |
Determines whether a document is in run mode or design mode. Read/write.
Version Information
Version Added: Visio 5.0
Syntax
expression.Mode
expression A variable that represents a Document object.
Return Value
VisDocModeArgs
Remarks
A Microsoft Office Visio document is either in run mode or in design mode, just as a Microsoft Visual Basic form is either running or being designed.
The following are the fundamental distinctions between run mode and design mode:
- ActiveX controls hosted in a document are told not to fire events when the document is in design mode, and to fire events when in run mode.
- Visio doesn't source events from any object whose document is in design mode.
The run/design mode of a Visio document is reported in the Visio user interface by the Design Mode button on the Developer toolbar. The appearance of this button is the same as the Design Mode button in the Visual Basic Editor window. If the button appears pressed, the document (project) is in design mode. If it does not appear pressed, the document (project) is in run mode.
The run/design mode of a Visio document is synchronized with the run/design state of the document's Visual Basic for Applications (VBA) project, provided the document has a project. If the document transitions to or from run mode, the project's mode switches, and vice versa. This means that if code in a document's project sets the document's mode to design mode (ThisDocument.Mode = visDocModeDesign), the project in which the code runs transitions to design mode and any statements following the mode-assignment statement are not executed. However, code in a document can put another document (project) into design mode and keep running.
A document's mode is not a persistent property. By default, a Visio document opens in design mode unless the document is from a trusted publisher, is digitally signed, or is in a trusted location. A document that meets one of these criteria opens in run mode.
However, you can change default settings in the Macro Settings category of the Visio Trust Center (Tools menu). If Disable all macros except digitally signed macros is selected, Visio documents not in a trusted location open in run mode only if they are digitally signed. If Disable all macros without notification or Disable all macros with notification is selected, documents not in a trusted location open in design mode. If Enable all macros is selected, documents always open in run mode, but this option presents a security risk and is not recommended.
See Also