Consulting

Results 1 to 7 of 7

Thread: Alternative to late Binding?

  1. #1

    Alternative to late Binding?

    Greetings, all, new guy here. I found this place quite by accident and Im glad I did! Anyhoo, heres my situation:

    Developing some code in another MS-Office compatible app to open excel using OLE, and write some cells. However, Im the only one in the office with the new 2007, while everyone else is running 2003.

    There has gotta be another alternative to using early binding: the code developement and execution times are so much slower using early binding, and I know there will be many code changes to come. Is there a third alternative? Some sort of 'load library' call where I can conditionally load the binaries?

    Since Im the only user NOT using the same version app, would it be possible to even grab the .tlb from the earlier version of excel and point my references there?

    Or perhaps something else id not even considered ?

  2. #2
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    Hi there, and welcome to VBAX.

    Personally I haven't found too much noticeable difference in execution speed with early vs late binding, but then it may depend on just how much you are doing with it.

    With regards to devleopment time being slower using late binding, why develop in that manner? A good friend of mine once told me to always develop early, release late. This way you get all the access to the intellisense and such for development and tesitng, and then you convert it to a late bound model for release to the wild. At that point the references to the app versions are a non issue.

    A third option though, if you really want to go there, is to leverage some code to strip the references and re-reference at opening. You can find some KB entries to do this here:
    Remove Missing VBA Library References via code
    Add a VBA Reference Library via code
    Determine the File Path or GUID to a VBA Reference Library
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  3. #3

    nice code ....

    and thats definitely going into the library.... but I should rethink the 'develop early / release late' ... which begs the other question - (you probably seen this comin'...) .. is there VBE routines to find/replace code, so I can replace the app-specific objects with generic objects?

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Do it with conditional compilation.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    Quote Originally Posted by rocheey
    and thats definitely going into the library.... but I should rethink the 'develop early / release late' ... which begs the other question - (you probably seen this comin'...) .. is there VBE routines to find/replace code, so I can replace the app-specific objects with generic objects?
    Honestly, I just use the find/replace feature in the VBE to do this.

    Quote Originally Posted by xld
    Do it with conditional compilation.
    That would be an alternative, for sure. Bob, you should put up an example of this on your site.
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Ken Puls
    That would be an alternative, for sure. Bob, you should put up an example of this on your site.
    Good idea, I will get onto it this week.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    Quote Originally Posted by xld
    Good idea, I will get onto it this week.
    Excellent. Looking forward to reading it.
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





Posting Permissions

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