Early Versus Late BindingAll the declarations so far in this chapter have used early binding, meaning the object type is explicitly spelled out in the code. However, late binding is also an option, as in the following example: Dim objX As Object Set objX = CreateObject(MyObj.MyClass) Late binding uses the CreateObject function and a string identifier. The disadvantage of late binding is that because objX is declared of a generic type Object, the properties and methods cannot be viewed in the Object Browser, and the intelligent typing features are not available. However, sometimes you do want to use late binding because it allows you to change the object without recompiling the program that uses it.
One example of when you might want to use late binding is when creating an instance of an object on a remote machine. |
|
![]() |
![]() |
|||