# Controlling QlikView with automation and macros

## External control of QlikView

QlikView objects are accessible by means of Automation from external programs, for example programs written in Visual Basic or C++ supporting Automation.

Such code can be used to control QlikView from other applications or from stand-alone programs.

Stand-alone executable files can be invoked from a QlikView document by means of launch buttons.

## Internal VBScript interpreter

QlikView objects are also accessible via Automation from inside QlikView by means of the built-in VBScript interpreter.

Macros written in VBScript inside a QlikView application can currently be invoked as an action trigger in several ways:

Application events

| Event ID | Event Description |
| --- | --- |
| 1 | A macro can be run after opening a QlikView document. |
| 2 | A macro can be run after script re-execution. |
| 3 | A macro can be run after the Reduce Data command. |
| 4 | A macro can be run after a selection in any field in the application. |

Sheet events

| Event ID | Event Description |
| --- | --- |
| 5 | A macro can be run after a sheet is activated. |
| 6 | A macro can be run when a sheet is deactivated. |

Sheet object events

| Event ID | Event Description |
| --- | --- |
| 7 | A macro can be run after a sheet object is activated. |
| 8 | A macro can be run when a sheet object is deactivated. |

Button events

| Event ID | Event Description |
| --- | --- |
| 9 | A button sheet object can be linked to a macro. |

Field events

| Event ID | Event Description |
| --- | --- |
| 10 | A macro can be run after a selection has been made in a specified field. |
| 11 | A macro can be run when a selection is made in any field logically associated with a specified field. |
| 12 | A macro can be run after selections have been locked in a specified field. |
| 13 | A macro can be run after selections have been locked in a specified field. |

Variable events

| Event ID | Event Description |
| --- | --- |
| 14 | A macro can be run after a value has been entered in a specified variable. |
| 15 | A macro can be run when the value of a specified variable containing a formula has been changed due to a change in the formula value. |