A Discussion On Early vs Late Binding

What is "Binding"?

"Binding" is essentially the process of connecting to the object model of an application to make use of its objects, properties and methods. There are two methods to accomplish this: Early Binding and Late Binding.

Early Binding:

Early binding is the process of explicitly setting a reference to the library which contains the object model you wish to access. This is done by going to Tools|References in the Visual Basic Editor, and placing a check mark next to the code library you wish to access.

  1. Better performance than a Late bind
  2. The object library is exposed to "intellisense" should you need to make any modifications
  3. You can search the code library in the object browser
  4. Makes it easier to see what arguments are required when developing code

Late Binding:

Late binding still attachs to the code library, but it does so at runtime.

  1. Makes the code more portable to other projects as you do not need to set a reference in the new project
  2. Easier for beginners to add to a project as it does not require setting references
  3. Eliminates a potential issue with sharing projects between different versions of an application. (Libraries are automatically upgraded, causing code to error when sent back to the lesser version.)

More Information:

For more information, you may be interested in reading Bob Phillips article at xldynamic.com which explains how to convert an Early Bind to a Late Bind.

In Summary

Due to the value of tools available when using an Early bind, it is recommended to use an Early bind to develop code. Once done, however, the code should be converted to a Late bind for general release since it is more portable and robust for environments which house multiple versions of applications.

Share:

Facebook
Twitter
LinkedIn

5 thoughts on “A Discussion On Early vs Late Binding

  1. Pingback: Printing Worksheets To A PDF File (Using Early Binding) - Excelguru

  2. Pingback: Printing Multiple Word Documents to a Single PDF - Excelguru

  3. Pingback: Resetting PDFCreator Options via Code - Excelguru

  4. Pingback: Send Email Using ClickYes - Excelguru

  5. Pingback: Print To Picture Using PDFCreator - Excelguru

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Posts