Microsoft KB Archive/323451

= Visio2000: How to Use the Database Wizard in Microsoft Visio to Link Shape Data to an Excel Worksheet =

Article ID: 323451

Article Last Modified on 2/1/2007

-

APPLIES TO


 * Microsoft Visio 2000 Enterprise Edition
 * Microsoft Visio 2000 Professional Edition
 * Microsoft Visio 2000 Standard Edition
 * Microsoft Visio 2000 Technical Edition

-



This article was previously published under Q323451



SUMMARY
This article describes how to use the Database Wizard in Microsoft Visio 2000 to link shape data in a Visio drawing to a Microsoft Excel file.



Part 1: Export Visio Data to the Excel Worksheet
To export data that is stored in shapes on a Visio drawing to an Excel worksheet, follow these steps:  Start Excel, create a new workbook, and then save it. Make a note of the name and location of the file, and then quit Excel. Start Visio, and then open the drawing that contains the shape data that you want to export.

NOTE: If you do not have a Visio drawing that you can use, create a new Visio drawing that is based on the Block Diagram template. To do this:  On the File menu, point to New, point to Block Diagram, and then click Basic Diagram. From the Basic Shapes stencil, drag a Square shape to the drawing page. Right-click the shape, point to Format, and then click Fill. In the Color box, click the color that you want, and then click OK.</li></ol> </li> On the Tools menu, point to Macros, point to Visio Extras, and then click Database Export.

The Database Export Wizard starts.</li> Click Next.</li> Verify that the drawing that you want to export appears in the Choose a drawing or click Browse to open a drawing box, and then click Next.</li> Specify the shapes in the drawing from which you want to export data, and then click Next.</li> Specify the Shapesheet cells and fields that you want to export, and then click Next.</li> In the Select an ODBC data source to export to list, click Excel Files, and then click Next.</li> In the Select Workbook dialog box, locate and click the Excel file where you want to export the shape data, and then click OK.</li> Under Specify the export table details, type a name in the Table Name box. This is the name of the Excel worksheet to which the shape data is exported.

Verify that ShapeKey appears in the Key Field box and ShapeID appears in the Key Type box. Click Next.</li> Accept the default settings that appear under Specify the export mapping details. Click Next.</li> Click to select the Add export right mouse action to the drawing page check box, and then click Next.</li> Verify that the options that you selected are correct, and then click Finish.</li></ol>

Part 2: Link Visio Data to the Excel Worksheet
<ol> On the Tools menu, point to Macros, point to Visio Extras, and then click Database Wizard.

The Database Wizard starts.</li> Click Next.</li> Click Link shapes to database records, and then click Next.</li> Click Shape(s) in a drawing, and then click Next.</li> <li>Verify that the drawing that you want to export appears in the Choose a drawing or click Browse to open a drawing box, and then click Next.</li> <li>Under Choose an existing data source or click Create Data Source to define a new data source, click Excel Files, and then click Next.</li> <li>In the Select Workbook dialog box, locate and click the Excel file that you want to use as the data source, and then click OK.</li> <li>Under Object types, click to select the Tables and Views check boxes, and then click Next.</li> <li>Verify that 1 appears in the Number of fields box, and then click Next.</li> <li>Under Choose the primary key field from the database table, click ShapeKey in the Field list, and then click Next.</li> <li>Verify that 1 is selected in the Key value list, and then click Next.</li> <li>Under Choose the events and actions to add to the shape, do the following: <ol style="list-style-type: lower-alpha;"> <li>Under Shape Events, click to select the Include an on drop event with the shape check box and Refresh shape on drop.</li> <li>Click to select all check boxes under Right mouse actions.</li> <li>Click Next.</li></ol> </li> <li>Under Choose the shape cell to be used for storing the primary key field value, verify that Prop.ShapeKey appears in the Cell box, and then click Next.</li> <li>Click Automatic, and then click Next.</li> <li>Click Finish.</li> <li>Right-click the shape on your drawing page. Note that the following options appear on the shortcut menu that appears: <ul> <li>Select Database Record</li> <li>Refresh Shapes Properties</li> <li>Update Database Record</li> <li>Delete Shape and Record</li></ul> </li> <li>Click the option that you want.</li></ol>

<div class="references_section">