Message 1 of 6
Trying to Handle API Events in iLogic Rule Broke Part
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I was trying to see if API events work in an iLogic rule because I need some code to be local to a document. I came up with the code below and, sure enough, it worked! However, I think it worked too well because I get about 8 messageboxes every time the document is saved. Setting docEvents = Nothing doesn't fix it. Suppressing and even deleting the rule doesn't fix it.
Class Main
Dim thisDocument As Document
Dim WithEvents docEvents As DocumentEvents
Sub Main()
thisDocument = ThisDoc.document
docEvents = thisDocument.documentevents
End Sub
Sub Handler(BeforeOrAfter As EventTimingEnum,
Context As NameValueMap,
ByRef HandlingCode As HandlingCodeEnum) Handles docEvents.onsave
If BeforeOrAfter = EventTimingEnum.kBefore
MessageBox.Show("It Works")
End If
End Sub
End Class