Volume 3: Programming with the Visio Object Model disclaimer



Download 0.78 Mb.
Page28/36
Date29.01.2017
Size0.78 Mb.
#11974
1   ...   24   25   26   27   28   29   30   31   ...   36

Lab 3.7: Data Linking


During this lab, you will recreate a portion of the ScheduleBuilder program. In the process you will also fix some program errors that exist in the lab version of the file.

You will use automation code to:



  1. Fix the error in finding and loading the Section DataRecordset from an external Excel data file.

  2. Link the Instructor shapes to rows in the Teacher DRS. (LinkSelectedInstructors)

  3. Drop and link the Section shapes to rows in the Section DRS. (DropSectionShapes)

  4. Refresh the Section DRS after changing the Excel file to add one or more records, delete one or more records and modify one or more records

  5. Fix a problem in the linking/refresh conflicts logic that is preventing the conflict resolution from working properly.

Estimated time to complete this lab: 90 minutes
Before You Begin

To complete this lab, you will need:

  • Participants should have completed the Try This! Lessons of this module before completing this lab.

  • Visio 2007 or later installed and configured.

  • The following files are needed to complete this lab:

    • Lab Module 3 Start.vsd

    • ScheduleBuilder.vss

    • ScheduleBuilder.xls

    • Completed Visio drawing created in lab 3.6 (a completed file is provided)
What You Will Learn

After completing this lab, you will be able to:

  • Attach to an external data set via automation code

  • Automatically link shapes to rows in a DataRecordset

  • Drop multiple shapes onto a drawing and link them to rows in a DataRecordset

  • Manage Refresh of external data and resolve refresh conflicts

27.Exercise : Connect to an external data set

Scenario


There is an error when opening the drawing Lab 3.8 Start.vsd. The error appears when trying to connect to an Excel file. You must diagnose the error and repair the code.

Tasks


  1. Start Visio and open the file Lab 3.8 Start.vsd. The following error message appears.



  1. Select Debug and review the comments in the code. Recode the CreateLink procedure to load the DataRecordset properly.

28.Exercise 2: Link the Instructor shapes to rows in the Teacher DataRecordset

Scenario


The Instructor shapes must be linked to their respective rows in the Teacher DRS in order to later drop the Section shapes properly.

Tasks


  1. Look at the macro LinkSelectedInstructors. It is incomplete.

  2. Read the comments in the code and complete the macro.

29.Exercise 3: Drop and link the Section shapes to the rows in the Section DataRecordset

Scenario


The macro DropSectionShapes will drop a Section shape for each record in the Section DRS.

Tasks


  1. Find the macro DropSectionShapes. It is incomplete.

  2. Read the comments in the macro and complete the code.

30.Exercise 4: Change the external data, refresh the drawing, and manage changes required by the data

Scenario


Change the Excel file containing the Section data so that some new records are added, some existing records are deleted, and some existing records are changed. Refresh the DataRecordset from the user interface. You find that the conflicts are not being refreshed correctly.

Tasks


  1. Look at the event procedure sectionRecordset_DataRecordsetChanged. This event procedure listens for changes to the DRS and then evaluates and processes the changes. It adds new Section shapes for each new record added, deletes Section shapes for any deleted records.

You will find that the updates are not happening properly. Your task is to figure out why and make the necessary changes.

Additional Resources – External Data

What’s New for Developers in Visio 2007 (Part 1 of 2)

This article introduces new features of interest to developers in Microsoft Office Visio 2007 and explains how to use them. Author: Saul Candib.

http://msdn2.microsoft.com/en-us/library/aa395290.aspx

What’s New for Developers in Visio 2007 (Part 2 of 2)

This article describes all new objects and members of the Visio 2007 VBA object model and newly deprecated existing members. Author: Saul Candib.

http://msdn2.microsoft.com/en-us/library/aa395291.aspx

Visio Developer Portal

http://msdn2.microsoft.com/en-us/office/aa905478.aspx

Integrating Visio 2007 and Microsoft SQL Server 2005

Learn how you can integrate Microsoft Office Visio 2007 with Microsoft SQL Server 2005, to create data-driven diagrams from stored SQL data.

http://msdn2.microsoft.com/en-us/library/bb267248.aspx



Integrating Visio 2007 and Access 2007

Use Automation code to create a Visio drawing from data defining the contents of a drawing and the connectivity between shapes stored within Access tables.

http://msdn2.microsoft.com/en-us/library/aa722522.aspx



Visio 2010 Beta: Software Development Kit

The Microsoft Office Visio Software Development Kit (SDK) contains the latest documentation, samples, header files, libraries and tools that you need to develop custom solutions for Microsoft Visio. As of this writing the 2010 Beta version was the latest version available.

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=1cdbb7e7-6bd4-488f-91bd-7bd732dbf378


About Connecting to Data in Visio

http://msdn2.microsoft.com/en-us/library/aa342321.aspx
About Linking Shapes to Data

http://msdn2.microsoft.com/en-us/library/aa342322.aspx




Download 0.78 Mb.

Share with your friends:
1   ...   24   25   26   27   28   29   30   31   ...   36




The database is protected by copyright ©ininet.org 2024
send message

    Main page