Using debug.print to display shape data and page info

Started by WCTICK, December 07, 2023, 05:11:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WCTICK

I have a Visio Org Chart with shape data that includes a field called Position Number.

When displaying shape data info it shows as Prop.PositionNumber and the label is "Position Number".

I am trying to write a script that will loop through each page and for the first shape where that shape data exists on a page, print the page name and
position number associated with the shape.  I am able to print the page name but have been unable to figure out how to print the shape data PositionNumber for the selected shape.

Dim pg As Page
Dim shp As Shape
 
  For Each pg In ActiveDocument.Pages
    For Each shp In pg.Shapes
      If shp.CellExists("Prop.PositionNumber", False) Then
      Debug.Print pg.Name
      End If
    Next shp

If I use the debug.Print line:

Debug.Print pg.Name, shp.Prop.PositionNumber

I get the error, "Object doesn't support this Property or Method"

I am obviously not very knowledgeable of VBA and Visio variables.  Can anyone point me in the right direction?  Thanks.

Surrogate