Hi Laetitia,
I think catching form close Item event works. Because as I found, when choosing Close menu, a message box will send out saying that do you want to cancel/close form. When you click the button, a form close event will be sent.
In this case, you could do this with the code below.
Private Sub m_oApplication_ItemEvent(ByVal FormUid As String, pVal As SAPbouiCOM.ItemEvent, BubbleEvent As Boolean)
Select Case pVal.EventType
Case et_FORM_CLOSE
MsgBox "Catch!" ' please add your code here.
End Select
End Sub
If this solution does not fit your situation, you can catch the menu event directly. Please refer to the code below.
Private Sub m_oApplication_MenuEvent(pVal As SAPbouiCOM.IMenuEvent, BubbleEvent As Boolean)
If pVal.BeforeAction = True Then
Select Case pVal.MenuUID
Case "1286"
' Do whatever you want here.
End Select
End If
End Sub
Hope these two solutions work.
Best Regards,
Nicky He
Add a comment