下列示例从活动文档中对象Rect2的Click事件中删除所有代码行。
Dim o As Object
Dim oProc As Object
Dim lIndex As Long
Dim lFound As Long
Set o = Application.ActiveDocument.Page.FindObject("Rect2")
o.Procedures.GetEventHandlerIndex "Click", lIndex, lFound
If (lFound) Then
Set oProc = o.Procedures.Item(lIndex)
oProc.Lines.RemoveAll
End If