How to know which CommandButton called the macro?

Imagine, I have create the calc dialog with several CommanButtons and I want to connect all of them to the same macro. While this macro is running, how can I know which CommandButton called this macro?


Attached is a sample demonstrating this. The macro uses oEvent.source to obtain the control Model. In the model you can examine the control name or the button label to determine which was pressed. The sample demos both.

Sample ------ DialogButtonPressed.ods

Thank you very much. This is exactly what I wanted.