Using Specific Object Types

References to objects and their methods and properties are resolved either when your macro is compiled or when it runs. References that are resolved when the macro is compiled are faster than references that must be resolved while the macro is running.

If you declare variables and arguments as specific object types (such as TextBox or Worksheet), Visual Basic can resolve references to the properties and methods of those objects when your macro is compiled. For a list of specific object types, see the Object Browser.

If you declare variables and arguments with the generic Object data type, Visual Basic may have to resolve references to their properties and methods when it encounters them at run time, resulting in a significantly slower process.

For information about object types, see Chapter 4, "Objects and Collections." For more information about declaring object variables, see Chapter 2, "Variables, Constants, and Data Types."