Animation, Again

M

MikeM

As recommended, I bought Visio 2007 and read the articles Scott recommended.
But they're not that clear. Two questions (for the moment, anyway!):

1. As suggested, I turned on the macro recorder and ran the data link
utility. Every time I run the macro to link an Excel file to a document
(while debugging), there's an error because there's a new ItemFromID number
in the line

Application.ActiveDocument.DataRecordsets.ItemFromID(5).SetPrimaryKey
VisPrimaryKeySettings.visKeySingle, vsoPrimaryKeys1

How do I ascertain the number when I run the macro? Or do I even need this
line?

2. I have a simple data set with 3 columns: year, pinX and pinY. I want to
use VBA to sequentially move an icon year by year (as in Hans Rosling's
Gapminder project at http://www.ted.com/index.php/talks/view/id/92). How do I
reference a point? That is, how do I assign Sheet1!B2 to the shape's pinX
and Sheet1!C2 to pinY?

TIA,
Mike
 
M

Mark Nelson [MS]

Hi Mike,

It's not clear what you intend to do here. Just to be sure you understand,
animation is not a built-in Visio capability. There are ways to do this
through code, which is the method outlined in Graham Wideman's book. Visio
2007's Data Link feature offers a different possible method.

It sounds like the data you want to use to drive the position of shapes is
found in Excel. How is this data structured? Is there a row for each time
segment, such that a given Excel spreadsheet supplies the data for one Visio
shape? Or is there a different row for each shape with the value in that
row changing over time?

Visio's Data Link feature will connect to the external data and let you map
individual rows from that data to individual shapes on the page. Thus it
would work best for each row in Excel to represent a different object rather
than a different time segment. Once you link rows to shapes, you need to
drive the position of the shape from the shape data. This is done through
formulas you set up in the Shapesheet. There is a good article that
explains the technique here:
http://blogs.msdn.com/visio/archive/2007/02/06/introducing-the-bubble-chart.aspx

I'm not sure what macro recording the Data Link step would help with.
Perhaps you can offer further explanations. It may be that you are trying
to write code to solve the part that can be done without code.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top