Determines whether a document is in run mode or design mode.
VisDocModeArgs. Current mode of the document.
Required. An expression that returns a Document object.
Required VisDocModeArgs. The new mode of the document; visDocModeRun (0) to set run mode, or visDocModeDesign (1) to set design mode.
A 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 pressed, the document (project) is in design mode. If not 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/from run mode, then 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 executes transitions to design mode and any statements following the mode assignment statement don't execute. 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. A document's initial mode is determined by the setting on the Security Level tab in the Security dialog box (on the Tools menu, point to Macros, and then click Security). The security levels are described as follows:
- Low (not recommended), the document opens in run mode.
- Medium, the document opens in run mode if it does not contain a project or contains a project from a trusted source. If the document contains a project that is unsigned or from an untrusted source, an alert appears with buttons to Disable Macros or Enable Macros. If Enable Macros is selected, the document opens in run mode; if Disable Macros is selected, it opens and remains in design mode.
- High, the document opens in run mode if it does not contain a project or contains a signed project from a trusted source. If the document contains an unsigned project, it opens and remains in design mode. If the document contains a signed project from an untrusted source, an alert appears with a Disable button and a dimmed Enable button (unless the Always trust macros from this source check box is selected). If Disable is selected the document opens and remains in design mode; otherwise, if Enable is selected, it opens in run mode.