您好我有这个VB6代码
Public Sub ShowOperations()
Dim Drw As Drawing
Set Drw = App.ActiveDrawing
Dim Ops As Operations
Set Ops = Drw.Operations
Dim Op As Operation
For Each Op In Ops
For Each SubOp In Op.SubOperations
Debug.Print Op.Number & "-" & Op.SubOperations.Count
Next SubOp
Next Op
End Sub
在操作中可以进行更多的子操作。 但我的结果是这样的
1-1
2-2
2-2
3-1
4-3
4-3
4-3
5-1
正如您在操作2中看到的那样,它向我展示了总共2个子操作...但我需要研究结果
1-1
2-1
2-2
3-1
4-1
4-2
4-3
5-1
我可以帮助这个人......
谢谢
答案 0 :(得分:1)
只需添加一个SubOp计数器:
Dim nSubOp As Long '<--| declare a SubOp counter
For Each Op In Ops
nSubOp = 0 '<--| initialize SubOp counter
For Each SubOp In Op.SubOperations
nSubOp = nSubOp + 1 '<--| update SubOp counter
Debug.Print Op.Number & "-" & nSubOp
Next SubOp
Next Op