Running VBA modules

An Excel/VBA application can be anything from a small routine that performs a useful service to a large application that completely shields the user from Excel's basic interface. Excel provides a variety of ways to launch an application that can be tailored to suit the system. The ways is which an Excel VBA program can be launched are as follows:

By using Tools > Macro > Macros, selecting the macro and clicking the Run button (see Figure 3.11).

Figure 3.11 Invoking a macro with the Macro dialog box.

By assigning a button to the macro. Examples of this were given in Chapter 2.

By assigning your VBA procedure to a built-in macro. Excel contains four built-in automatic macros, which are invoked when some event occurs. These built-in macros are:

Auto_Open - invoked whenever a workbook containing the macro is opened.

Auto_Close - invoked whenever the workbook containing the macro is closed.

OnSheetActivate - invoked when you first enter data on a worksheet. OnEntry - invoked when you enter a worksheet.

0 0

Post a comment