Displaying Shape Data as a Datagraphic using VB

Started by bcummings30044, February 28, 2011, 08:44:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bcummings30044

I am not new to VB, but I am new to VB for Visio.  I am using the Organization Chart Shapes stencil, and I have dragged over a single "Manager" box.  On the Shape Data, for the Name I have typed Joe, and for the Department I have typed HR.  By default, only the Name is displayed.  I have also created a datagraphic that puts the Department into a Text Callout.  I want to be able to link the Manager shape to the Datagraphic, and display the Department as a text callout at the bottom of the Manager shape.  I am really struggling with the syntax on this one, and for someone who is an expert in this, I suspect that this is short work.  Can anyone provide me with sample VB code to do this?  If you can throw in a line for resetting the font size from 9 to 6 as well, that would be great. 

Brian

bcummings30044

I figured it out.  I needed to Apply the Data Graphic to the shape.  For anyone else who wonders how to do this:

      Dim lcCurrentDocument As Visio.Documents
      Dim lcDataGraphic As Master

      Set lcCurrentDocument = Visio.Documents
      Set lcDataGraphic = lcCurrentDocument.Item(1).Masters("<YourDataGraphicNameHere>")
      lcCurrentShape.DataGraphic = lcDataGraphic

If I could only figure out how to set the font size of the text callout inside the Datagraphic.  I know that in Visio 2010, they have opened this up as an attribute, but I have Visio 2007.  If anyone has figured this out, please post.

Brian