The following sub in my com-addin does not cause any problems:
Private Sub MonthCalendar1_DateChanged(sender As Object, e As Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged
Dim ExcelApp As Excel.Application = CType(AddinExpress.MSO.ADXAddinModule.CurrentInstance, AddinModule).ExcelApp
ExcelApp.ActiveCell.Value = MonthCalendar1.SelectionStart.Date
End Sub
The following sub however, where I have added a Me.Close() statement, causes Excel to crash. What might the reason be?
Private Sub MonthCalendar1_DateChanged(sender As Object, e As Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged
Dim ExcelApp As Excel.Application = CType(AddinExpress.MSO.ADXAddinModule.CurrentInstance, AddinModule).ExcelApp
ExcelApp.ActiveCell.Value = MonthCalendar1.SelectionStart.Date
Me.Close()
End Sub
EDIT: Maybe my code triggers some other event in my code to execute and that causes Excel to crash? Is it possible to pause execution at the start of any event? Since I don't know which event might be called, I would't know where to add a breakpoint.
Aucun commentaire:
Enregistrer un commentaire