Early binding is when you tell the compiler up front what kind of objects
you will be using. This is done in the VBE through Tools | References...
In your example, use the above menu item to see if you have references to
Excel and Outlook. That will tell you whether you are or are not using
early binding.
[Actually, if you get set outapp=outlook.application to compile you are
using early binding. But, the Tools | References... is the first place I
would look.]
With early binding you can use set xl=excel.application or you can use
getobject and/or createobject. With late binding since the compiler doesn't
know the type of xl, you must use getobject and/or createobject.
You may want to see
Early and Late Binding
http://msdn2.microsoft.com/en-us/library/0tcf61s1.aspx
CreateObject Function (Visual Basic)
http://msdn2.microsoft.com/en-us/library/7t9k08y5.aspx
GetObject Function (Visual Basic)
http://msdn2.microsoft.com/en-us/library/e9waz863.aspx
While in most cases early binding is the preferred way to go, there are
instances when late binding is better. But, for learning purposes, early
binding is definitely the correct approach.
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article ,
says...
Okay... here goes:
Do you have to use CreateObject with set in early binding? For instance, I
have this lovely bit of code:
Set OutApp = Outlook.Application
Set xl = Excel.Application
Set data = xl.Workbooks("Time Exception Master Data")
Is this consider early binding? Should I instead say "Get" and then the
document path? I am confused.
Thanks,
Nicole