如何在visio中遍历某些形状?
How to iterate through some shapes in visio?
我想在 Visio 中迭代一些形状,我有一个可行的解决方案,但它有点低,因为有很多形状(可能有 1000 个,我只对迭代 20 个感兴趣或三十个):
Dim shp As Visio.Shape
Dim pagShape As Visio.Shape
Set pagShape = Visio.ActivePage.PageSheet
For Each shp In Visio.ActivePage.Shapes
If InStr(shp.Data3, "_tag") Then
If StrComp(Replace(shp.Data3, "_tag", ""), name) = 0 Then
shp.text = name
Else:
shp.text = ""
End If
End If
Next shp
是否可以在一种列表中添加一些形状而不是选择所有现有形状?
类似的东西:
For Each shp In List
非常感谢您:)
编辑:我就是这样做的:
声明和设置部分:
Public Collection_shp As Collection
Set Collection_shp = New Collection
当我创建标签形状时,我将其添加到集合中:
Collection_shp.Add Item:=vso_sg
循环部分:
Dim shp As Visio.Shape
For Each shp In Collection_shp
If InStr(shp.Data3, "_tag") > 0 Then
If StrComp(Replace(shp.Data3, "_tag", ""), name) = 0 Then
shp.text = name
Else
shp.text = ""
End If
End If
Next shp
我已经这样做了:
声明和设置部分:
Public Collection_shp As Collection
Set Collection_shp = New Collection
当我创建标签形状时,我将其添加到集合中:
Collection_shp.Add Item:=vso_sg
循环部分:
Dim shp As Visio.Shape
For Each shp In Collection_shp
If InStr(shp.Data3, "_tag") > 0 Then
If StrComp(Replace(shp.Data3, "_tag", ""), name) = 0 Then
shp.text = name
Else
shp.text = ""
End If
End If
Next shp
我想在 Visio 中迭代一些形状,我有一个可行的解决方案,但它有点低,因为有很多形状(可能有 1000 个,我只对迭代 20 个感兴趣或三十个):
Dim shp As Visio.Shape
Dim pagShape As Visio.Shape
Set pagShape = Visio.ActivePage.PageSheet
For Each shp In Visio.ActivePage.Shapes
If InStr(shp.Data3, "_tag") Then
If StrComp(Replace(shp.Data3, "_tag", ""), name) = 0 Then
shp.text = name
Else:
shp.text = ""
End If
End If
Next shp
是否可以在一种列表中添加一些形状而不是选择所有现有形状? 类似的东西:
For Each shp In List
非常感谢您:)
编辑:我就是这样做的:
声明和设置部分:
Public Collection_shp As Collection
Set Collection_shp = New Collection
当我创建标签形状时,我将其添加到集合中:
Collection_shp.Add Item:=vso_sg
循环部分:
Dim shp As Visio.Shape
For Each shp In Collection_shp
If InStr(shp.Data3, "_tag") > 0 Then
If StrComp(Replace(shp.Data3, "_tag", ""), name) = 0 Then
shp.text = name
Else
shp.text = ""
End If
End If
Next shp
我已经这样做了:
声明和设置部分:
Public Collection_shp As Collection
Set Collection_shp = New Collection
当我创建标签形状时,我将其添加到集合中:
Collection_shp.Add Item:=vso_sg
循环部分:
Dim shp As Visio.Shape
For Each shp In Collection_shp
If InStr(shp.Data3, "_tag") > 0 Then
If StrComp(Replace(shp.Data3, "_tag", ""), name) = 0 Then
shp.text = name
Else
shp.text = ""
End If
End If
Next shp