Reserved Words Cant Be Used for Variable Names

You can use any label you want for a variable name except for the reserved words that VBA uses. Visual Basic function names and certain other words that have a special meaning in VBA cannot be used as variable names. For example, words such as Name, Len, Empty, Local, Currency, or Exit will generate an error message if used as a variable name.

Give your variables names that can help you remember their roles. Some programmers use a prefix to identify the variable's type. A variable name preceded with "str," for example strName, can be quickly recognized within the procedure code as the one holding the text string.

0 0

Post a comment