Message 1 of 5
Remove iTriggers with iLogic

Not applicable
03-17-2017
09:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, i have an iTrigger set up on my assembly template, however, i would like to create a code that would remove the trigger in some of my assemblies. I cant delete the rules as they are external rules. I did found this code on the subject:
SyntaxEditor Code Snippet
'capture current document Dim oiLDoc As ThisApplication.ActiveDocument 'load up ilogic automation Dim oiLogicAuto As Object = iLogicVb.Automation 'get container for all of the ilogic rules Dim oRules As Object = oiLogicAuto.rules(oiLDoc) 'variable for the events rules Dim oiLPropSet As PropertySet 'set up a counter Dim iPropCount As Integer 'if there are no rules, then there is no need for event triggers'if there are no even rules, no need to go further'if not a part, I'm not interested If oRules Is Nothing And oiLDoc.PropertySets.PropertySetExists("iLogicEventsRules") And oiLDoc.DocumentType = 12290 Then 'set our property set since we know it exists now oiLPropSet = oiLDoc.PropertySets.Item("iLogicEventsRules") 'only iPart Members seem to be plagued with orphaned triggers'if there aren't any triggers, then we're done If oiLDoc.ComponentDefinition.IsiPartMember And oiLPropSet.Count > 0 Then 'iterate through the triggers and delete each For iPropCount = 1 To oiLPropSet.Count oiLPropSet.Item(iPropCount).Delete Next iPropCount End If End If
Which returns this error: Error on Line 2 : Type 'ThisApplication.ActiveDocument' is not defined.
and im not sure how to fix it. Anything would help!
Thanks