Share via

Custom Visio Solution: Executive Office Example (VBA, Multishapes, and Office Integration)

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.


Microsoft Corporation

December 2000

Applies to:      Microsoft Visio 2000 Standard Edition
     Microsoft Visio 2000 Professional Edition
     Microsoft Visio 2000 Technical Edition
     Microsoft Visio 2000 Enterprise Edition

Summary: The Executive Office demonstration shows how Microsoft Visio multishapes can be integrated with Microsoft Office and Microsoft Visual Basic (VBA) to form a custom Visio solution. (3 printed pages)

Download ExecutiveOffice.exe.


The Executive Office demonstration shows how Microsoft® Visio® can create objects based on Microsoft® Visual Basic® for Applications (VBA) classes, create an object to read all of the shapes on the drawing, and then use Microsoft® Word as an automation server. The demonstration is a simple office drawing where you can add or delete furniture and then generate a proposal for your customer.

What are we demonstrating about Visio?

  • Multishapes. Shapes with multiple geometry sections that change their features based on drawing characteristics.
  • VBA Object Instantiation. VBA code that shows how to use VBA objects in Visio.
  • Microsoft Office Integration. Visio uses Microsoft Word as an automation server.


What will the customer learn from this demonstration?

  • Integration. Easy Visio integration with Microsoft® Office.
  • Custom Properties and Data. Interaction with custom properties and retrieving or sending information to a database.
  • Multishapes. Simple, graphic example of multishapes.
  • VBA. VBA code examples, such as VB objects and collections.

Preparing for the Demo



This demonstration requires Visio 2000 and Office 2000 to operate correctly. Please install these programs before trying to run the demo.

To prepare for the demo

  1. Download the ExecutiveOffice.exe file and unzip its contents into a temporary directory.
  2. The demonstration requires the following files:
    File Description
    ExecutiveOffice.vsd Sample finished office drawing
    Office.vss Stencil file with custom properties created for the office shapes Word template file
  3. The files can be installed in any directory, but make sure that Office.vss and are saved to the same folder as the drawing file.

Running the Demo

Print this document and follow the steps in Table 1 to run the Executive Office demo.

Table 1. Running the Executive Office demo

Key Points Description
Open Demo Open ExecutiveOffice.vsd.

This is where the first VBA code executes. In Visio, we are able to create objects based on VBA classes. These are implemented as class modules and define the properties and methods of an object. As the document opens, the program creates a collection of chair objects, and then looks for all of the conference chairs in the drawing and adds each one to the chairs collection.

Interact Click some of the objects in the drawing and view their Custom Properties.
Wet Bar Click the wet bar in the lower right of the drawing.

Note how the liquor bottles on the left of the wet bar are highlighted. Pause the pointer over some of the bottles to get a balloon telling you what bottle you are viewing.

Conference Table and Chairs Drag a conference chair into the office.

Note how the chair is automatically arranged around the table. If there are more than three conference chairs in the drawing, the table changes from a circular to a rectangular conference table and the chairs are arranged accordingly. Add up to six chairs to the drawing.

Trap events Delete chairs until you have three.

The program is able to trap the document's delete event and update the chairs collection. Again, it automatically adjusts the table type and rearranges the chairs.

Create Word doc Right-click the Visio drawing page again and select Generate Proposal.

This action will use Microsoft Word as an automation server. The program inserts drawing information into the Word document, including pasting the Visio drawing into the document. The program then populates a table with Bill of Material data retrieved from the drawing.

The example companies, organizations, products, people, and events depicted herein are fictitious. No association with any real company, organization, product, person, or event is intended or should be inferred.