An extension (also called "hook") is a script that is integrated into the execution process of a model. Extensions add behaviour that is not available out-of-the-box, such as automatically adding rows, hiding empty rows after download, or validating input before upload.
Each extension has:
- a code (`hok_code`) and description;
- a load order (`hok_load_order`), determining execution order when multiple extensions apply;
- an active flag, so extensions can be switched off without deleting them;
- a language (`hok_language`); extensions are typically written in VBA.
## Events
Extensions are attached to events of the [[Invantive Control for Excel/Concepts/Model|model]] and its [[Invantive Control for Excel/Concepts/Block|blocks]]. Available event types include:
| Category | Events |
| --- | --- |
| Model | model selected/changed, model opened, before/after synchronisation, download, upload |
| Block | selected block changed |
| Row | selected row changed, row added, row deleted |
| Field | selected field changed, field value changed |
From VBA, callbacks on these events are registered with [[I_RegisterCallback]]. See [[Invantive Control for Excel/VBA Procedures/VBA Procedures|VBA Procedures]] for the full VBA integration, including the standard procedures [[Auto_Add]], [[Auto_Remove]] and [[HandleError]].
## Custom Ribbon Buttons
A model can register up to ten custom buttons on the Control ribbon. Each button is bound to an extension, giving the model user one-click access to model-specific actions such as "generate journal entries" or "clean up report".