道歉这似乎相当基本,但我似乎无法找到足够的文件。 我基本上需要使用Visio 16中的VBA循环遍历形状表上“Shape Data”中的行。我正在寻找的代码(我想)会看起来像这样:
sub printLabelsAndProps()
for each x in UnknownGroupOfThings
debug.print x.prop.DataAndDocuments
debug.print x.prop.Supports
Next
end sub
帮助表示赞赏
答案 0 :(得分:0)
如果你知道你的所有形状都有" DataAndDocuments"和"支持"属性,您可以使用类似下面的代码(否则您可能需要使用.CellExists
检查形状是否具有这些属性)。此外,如果您的单元格包含计算字符串,那么您应该使用.ResultStr()
而不是.Formula
。如果这些值是数字,您甚至可以不使用.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
如果您想循环浏览单个形状的所有属性,可以使用以下内容:
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