Using Callbacks

Some of the API procedures require additional help from your program, and they get this help using a technique known as callbacks. A callback is a function in your VBA program that provides the extra help that the API procedure needs. You do not call this function directly; rather, it is called by the API procedure. Here's how it works:

1.
Your program calls the API procedure. One of the arguments to the procedure is the address of the VBA callback function.
2.
The API procedure calls the callback function when it is needed.
3.
The callback function performs whatever tasks are required, then execution returns to the API procedure.
4.
In some cases, steps 2 and 3 repeat multiple times.
5.
The API procedure terminates and returns execution ...

Get Office® XP Development with VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.