+ Reply to Thread
Results 1 to 19 of 19

Learning differences between Early Binding & Late Binding

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Learning differences between Early Binding & Late Binding

    I am trying to learn the important differences between using Early & Late binding. Below is a summary of what I have noted so far:
    1. Reference Libraries: Early = Required, Late = Doesn't use (? see post by Kyle123)
    2. Speed: Early = slightly faster, Late = slightly slower
    3. Intellisense: Early = Uses, Late = Doesn't use
    4. Compatibility: Early = Low, Late = High (? see post by Kyle123)


    My questions:
    1. Is there anything in the above summary that I have incorrect?
    2. Is there any important difference not in the above summary that I should be including?
    3. When using binding I am more concerned about compatibility for other uses (more than speed increase). Would it be an idea to write the code in Early (for Intellisense) then convert the code to Late after it is working correctly?
    Last edited by mc84excel; 06-25-2013 at 06:15 PM. Reason: Update to reflect input from others
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Learning differences between Early Binding & Late Binding

    2.Speed: Early = 2x(?) faster, Late = slower

    is debatable and do not think it is a good idea to generalise.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Learning differences between Early Binding & Late Binding

    1. 3? Not really sure what Intellisense has to do with error-checking/debugging.

    2. Constants missing when late-binding.

    3. It think you'll find that a lot of people take that approach as Early allows Intellisense and constants.
    If posting code please use code tags, see here.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Learning differences between Early Binding & Late Binding

    Some libraries don't work properly with late binding - some features may not be available.

  5. #5
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Learning differences between Early Binding & Late Binding

    Quote Originally Posted by AB33 View Post
    2.Speed: Early = 2x(?) faster, Late = slower

    is debatable and do not think it is a good idea to generalise.
    I confess that the concepts of Early & Late binding is something I have only recently started learning.

    I read somewhere that the speed of Early binding is around twice as fast as Late binding. If that isn't correct, please instruct me as to what is the speed difference. I am open to corrections to my assumptions (which is why I started this thread).

  6. #6
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Learning differences between Early Binding & Late Binding

    Quote Originally Posted by Norie View Post
    1. 3? Not really sure what Intellisense has to do with error-checking/debugging.

    2. Constants missing when late-binding.

    3. It think you'll find that a lot of people take that approach as Early allows Intellisense and constants.
    Thanks Norie.

    1. Probably bad choice of wording on my part. Intellisense helps you detect misspellings when you write the code?

    2. Could you please expand on this?

  7. #7
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Learning differences between Early Binding & Late Binding

    Quote Originally Posted by Kyle123 View Post
    Some libraries don't work properly with late binding - some features may not be available.
    Now I'm confused. My understanding was that Late binding didn't rely on having specific Reference Libraries being enabled in order to run the code - which makes Late much more compatible when compared to Early. Could you please expand on this statement (or provide a hyperlink to a web page covering this)?

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Learning differences between Early Binding & Late Binding

    Yes, you are right early is generally faster than late, but I would not put in quantitative measurement.

  9. #9
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Learning differences between Early Binding & Late Binding

    OK I'll update the OP for this. (Myself - when the speed increase is so small, I am more focused on compatibility).

  10. #10
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Learning differences between Early Binding & Late Binding

    Off the top of my head, consider:

    Please Login or Register  to view this content.
    The above requires a reference to the MS HTML Object Library and IE9+. As you can see, the early bound object has access to the method, whereas the late bound does not. It isn't really a major issue, especially if you set minimum requirements for your workbook since nothing beats proper testing on different platforms - just something to bear in mind.

    FWIW I rarely ever used late binding, since there was a set structure of software where the versions could be guaranteed. I mostly use late binding when replying to answers in forums since it gets the solution up and running more quickly without confusing posters.

  11. #11
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Learning differences between Early Binding & Late Binding

    Even with early binding you need to ensure the recipient of the workbook has the required library/referenced file(s).
    Cheers
    Andy
    www.andypope.info

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Learning differences between Early Binding & Late Binding


  13. #13
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Learning differences between Early Binding & Late Binding

    Quote Originally Posted by Kyle123 View Post
    As you can see, the early bound object has access to the method, whereas the late bound does not.
    You lost me on that sentence. (I have only recently started learning Early/Late Binding)

  14. #14
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Learning differences between Early Binding & Late Binding

    Quote Originally Posted by Andy Pope View Post
    Even with early binding you need to ensure the recipient of the workbook has the required library/referenced file(s).
    Thanks. That reason is why I am leaning towards adopting Late Binding permanently.

    (Except post #10 has got me worried :S )

  15. #15
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Learning differences between Early Binding & Late Binding

    Quote Originally Posted by AB33 View Post
    Handy. Thanks +1

  16. #16
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Learning differences between Early Binding & Late Binding

    You lost me on that sentence. (I have only recently started learning Early/Late Binding)
    It isn't complicated, did you run the code? - It becomes immediately apparent when you do
    Last edited by Kyle123; 06-27-2013 at 01:49 AM.

  17. #17
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Learning differences between Early Binding & Late Binding

    Quote Originally Posted by Kyle123 View Post
    It isn't complicated, did you run the code? - It becomes immediately apparent when you do
    I hadn't. (Runs it). Yes I see a problem now.

    You said this wasn't a major issue? How do you work around this (supposing you want to adopt Late Binding?)

  18. #18
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Learning differences between Early Binding & Late Binding

    I was leaning towards adopting Late Binding (to save relying on the right references enabled when sending code to other users) but now Kyle has raised doubts in my mind.

    I am considering a slightly alternative approach - how does the below sound?
    • Use Early Binding to write the code
    • At start of Sub, have code to programatically check if tool reference library is available
    • If lib unavailable, notify user and exit sub. (If available, programatically enable and cont. sub)

    (Note I'd still prefer to adopt Late Binding but I'm concerned about post #10)

  19. #19
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Learning differences between Early Binding & Late Binding

    Well I suppose it depends how many external libraries you're looking at using. As long as your code is thoroughly tested there's no issue and problems like I demonstrated are likely to be pretty few and far between

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1