Reputation: 8177
Apologies this seems rather basic, but i can't seem to find adequate documentation on it. I essentially need to cycle through the rows in "Shape Data" on the shape sheet, using VBA in Visio 16. The code i'm looking for (I imagine) will look somewhat like this:
sub printLabelsAndProps()
for each x in UnknownGroupOfThings
debug.print x.prop.DataAndDocuments
debug.print x.prop.Supports
Next
end sub
Help appreciated
Upvotes: 0
Views: 280
Reputation: 12235
In case you know that all your shapes have "DataAndDocuments" and "Supports" properties, you could use something like the code below (otherwise you may need to check if the shape has those properties using .CellExists
). Also if your cells contain calculated strings, then you should use .ResultStr()
instead of .Formula
. If those values are numbers, you can even go without .Formula
Sub printLabelsAndProps()
For Each x In ActivePage.Shapes
Debug.Print x.Cells("Prop.DataAndDocuments").Formula
Debug.Print x.Cells("Prop.Supports").Formula
Next
End Sub
If you want to cycle through all properties for a single shape, you could go with something like this:
Sub showAllProperties(x As Shape)
For i = 0 To x.Section(visSectionProp).Count - 1
Debug.Print x.CellsSRC(visSectionProp, i, visCustPropsLabel).Formula
Debug.Print x.CellsSRC(visSectionProp, i, visCustPropsValue).Formula
Next
End Sub
Upvotes: 0