Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

In my VBA application i have a listener setup that listens for OnSketchFinished, when the polygon is created a messagebox appears and then a userform.

My problem is that the listener will work 90% of the time, not 100%.

Here are the snippets of code in ThisDocument:

Private WithEvents EditEvents As Editor
Private m_pEditor As IEditor
Public Sub SetEvents()

' This is the listener for the Editor
Dim pID As New UID
pID = "esriEditor.Editor"
Set m_pEditor = Application.FindExtensionByCLSID(pID)
Set EditEvents = m_pEditor

End Sub

Private Function MxDocument_OpenDocument() As Boolean
Call SetEvents
End Function

Private Sub EditEvents_OnSketchFinished()
    Call frmCityDev.EditEvents

End Sub

In my form I have code for EditEvents which brings up a msgbox to notify that a new polygon has been created.

Am I missing something to make sure that the listener will always work?


share|improve this question
Your code looks sound. How are you finishing the sketch? F2 or right click and finish sketch? Finishing a part is not the same as finishing the sketch. –  Hornbydd Jan 5 '12 at 16:34
I'm double clicking when I finish the polygon, but I've hit F2 aswell and I get the same thing. Funny thing was yesterday I had no problems, today I have just tried it and the listener isnt working. –  Halil Siddique Jan 6 '12 at 9:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.