CitectVBA定制过程分析器6:删除名字叫做“我的趋势板2”下面叫做“趋势板2的2#趋势笔”
这是我在新浪博客发表过的一篇学习笔记,这里也发表一次
接着练习,这一次删除指定明治趋势板下指定名字的趋势笔,脚本如下:
Sub deleteSomePaneSomePen()
'删除指定名字趋势板下指定名字的趋势笔
Dim pa As Object
Dim hPanes As Object
Dim hPane As Object
Dim hPens As Object
Dim hPen As Object
Dim panecount
Dim i,j
Set pa=main_AN4
Set hPanes=pa.panes
For i=1 To hPanes.count
Set hPane=hPanes.item(i)
If hPane.name="我的趋势板2" Then
Set hPens=hPane.pens
For j=1 To hPens.count
Set hPen=hPens.item(j)
If hPen.name="趋势板2的2#模拟量趋势笔" Then
hPen.delete
End If
Next
End If
Next
End Sub