Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Pgina 1 de 2
2.
Declaring specific object types provides automatic type checking, faster code, and improved readability.
Assigning an Object Variable to an Object
Use the Set statement to assign an object to an object variable. You can assign an object expression or Nothing. For
example, the following object variable assignments are valid:
Setting an object variable equal to Nothing discontinues the association of the object variable with any specific
object. This prevents you from accidentally changing the object by changing the variable. An object variable is always
set to Nothing after closing the associated object so you can test whether or not the object variable points to a valid
object. For example:
mk:@MSITStore:C:\PROGRA~2\COMMON~1\MICROS~1\VBA\VBA6\1033\vbcn6.c...
13/01/2015
Pgina 2 de 2
Of course, this test can never determine with absolute certainty whether or not a user has closed the application
containing the object to which the object variable refers.
Referring to the Current Instance of an Object
Use the Me keyword to refer to the current instance of the object where the code is running. All procedures associated
with the current object have access to the object referred to as Me. Using Me is particularly useful for passing
information about the current instance of an object to a procedure in another module. For example, suppose you have
the following procedure in a module:
ChangeObjectColor Me
mk:@MSITStore:C:\PROGRA~2\COMMON~1\MICROS~1\VBA\VBA6\1033\vbcn6.c...
13/01/2015