Microsoft KB Archive/255038

From BetaArchive Wiki

PSS ID Number: 255038

Article Last Modified on 6/4/2003

The information in this article applies to:

  • Microsoft Visio 2000 Standard Edition
  • Microsoft Visio 2000 Professional Edition
  • Microsoft Visio 2000 Technical Edition
  • Microsoft Visio 2000 Enterprise Edition
  • Microsoft Visio Standard 5.0x
  • Microsoft Visio Professional 5.0x
  • Microsoft Visio Technical 5.0x
  • Microsoft Visio Enterprise 5.0x

This article was previously published under Q255038


The DOCMD function is an internal command that speeds the performance of certain functions and tasks. You can find a list of DOCMD commands in the Microsoft Visual Basic file Visconst.bas, which is placed in the Visio\DVS\Tools\Library folder when you install Visio Technical 5.0 or later. The DOCMD function is a type of shortcut that eliminates the need to enter repetitive formulas into the ShapeSheet window.

When using the DOCMD function, you use the syntax DOCMD(CommandID).



The most common use of the DOCMD function is to quickly display the Custom Properties dialog box.


To see how the DOCMD function is used to display the custom properties of the Desk Chair shape:

  1. Right-click the Desk Chair shape on the Office Layout stencil, and then click Custom Properties on the shortcut menu. This activates the DOCMD function, which displays the option to select Custom Properties directly from the shortcut menu.
  2. To view the DOCMD function, click the Desk Chair shape, and then click Show ShapeSheet on the Window menu.
  3. If you don't see an Actions section, on the View menu, click Sections, and then click to select the Actions check box. The Actions cell should look similar to the following table.

    Actions Action Menu Prompt Checked Disabled
    1 DOCMD(1312) "%Custom Properties" "Set the custom properties

    of the selected shape"

    No Formula No Formula


One limitation of the DOCMD function is that it does not support context checking. Context checking is a procedure used by Visio support professionals to ensure that all actions performed on a shape are appropriate to the situation and is important for users who are programming using OLE automation. You can see how context checking works in Visio. For example, Visio will not allow a user to save a document if no document is open; the Save command on the File menu is unavailable (dimmed). When you use OLE automation to program, the DOCMD function provides no such safeguards - the command is executed regardless of context, thereby returning an error message.

Although Visio support professionals use the DOCMD function, they run complicated shape tests on the context of each shape to ensure proper behavior. If you use the DOCMD function, be aware that it is undocumented and unsupported. Although, the results of improper use of the DOCMD function can be as harmless as receiving no response to a request, it can also generate errors within Visio that causes the program to stop responding.

The fact that Visconst.bas is the only source of information about the DOCMD function illustrates an important point: The function is used primarily by advanced shape developers and OLE automation programmers. Only shape developers who are able to allocate ample resources to test shapes that use the DOCMD function are encouraged to use the function.

TIP: Use the DOCMD function to pass only nondestructive arguments. That is, only pass commands which do not require that particular data be available to succeed.

Additional Facts

  • The DOCMD function does not accept parameters.
  • The DOCMD function can have multiple entries.

Keywords: KB255038
Technology: kbVisio2000Search kbVisio500xSearch kbVisioSearch kbZNotKeyword3