Читать книгу Excel 2019 Power Programming with VBA - Michael Alexander, Dick Kusleika - Страница 147

Forcing yourself to declare all variables

Оглавление

To force yourself to declare all the variables that you use, include the following as the first instruction in your VBA module:

Option Explicit

When this statement is present, VBA won't even execute a procedure if it contains an undeclared variable name. VBA issues the error message shown in Figure 3.1, and you must declare the variable before you can proceed.

FIGURE 3.1 VBA's way of telling you that your procedure contains an undeclared variable

Excel 2019 Power Programming with VBA

Подняться наверх