Here the scenario:
I want to analyze forms via VBA code and see which controls have events behind them and of what type they are (Event Procedure, Macro or Expression).
Now the problem:
I have code for the standard controls like Text Boxes, Option Buttons etc. that works fine.
or a bit more real life:
This throws (a catchable) run time error if the event does not exist for the control in question. If it exists, sEventDefinition will contain an empty string, the Expression, the Macro name or the term "[Event Procedure]". This way I can find out in VBA code if a theoretically possible event is in use for that control and what it does.
The approach above does only partially work for ActiveX controls like Tree Views. Some Events (like OnClick, OnKeyPress etc.) cannot be read that way. They are also not detectable by enumerating the control properties (only five events commmon to all ActiveX controls are listed, but not all).
So I am looking for VBA code that can read ALL event definitions of ActiveX controls.
Anyone, any thoughts?
Thomas
I want to analyze forms via VBA code and see which controls have events behind them and of what type they are (Event Procedure, Macro or Expression).
Now the problem:
I have code for the standard controls like Text Boxes, Option Buttons etc. that works fine.
Code:
EventDefinition = Control.Properties("<Name of Event>")
Code:
sEventDefinition = MyForm!txtTextBox.Properties("OnDblClick")
The approach above does only partially work for ActiveX controls like Tree Views. Some Events (like OnClick, OnKeyPress etc.) cannot be read that way. They are also not detectable by enumerating the control properties (only five events commmon to all ActiveX controls are listed, but not all).
So I am looking for VBA code that can read ALL event definitions of ActiveX controls.
Anyone, any thoughts?
Thomas