Broken references, disambiguation, and binding

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

A few weeks ago, I was involved in a discussion about Office XP databases that referenced the OL 10 library not automatically re-referencing to the OL 9.0 library when used on an Office 2k machine, and vice versa. The discussion is a little lengthy or I'd repeat it here. You can find it by clicking on search by author (ScottE), and it's the thread "Microsoft Outlook 9.0 Object Library" beginning on 1/28/04 in m.p.a.modulesdaovba

Here's my question. Disambiguation was one interesting solution that was proposed. Here's another solution that works (so far), on which I'm interested in your comments. I deleted the reference to any of the Outlook libraries, changed all of the Outlook object-level variables to object (dim ola as outlook.application changed to dim ola as object, etc), and changed any constants to their actual values (olContactItem changed to 10, or whatever the correct number is). Put another way, I late-bind the OL variables instead of early-binding them. All OL-related functions still work perfectly. I know it's said that early-binding is better (faster), but the dismabiguation solution adds a lot of complexness. What are the problems with the de-referencing solution

Thanks

- Scott
 
No problem, Scott. Late binding sounds like good idea for this situation.

The reason we generally prefer early binding is that it gives compile-time
notification of more errors, so it is easier to debug and fewer situations
fail at runtime. So you might want to early-bind until you have the basic
debugging done, and then switch to late binding.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

ScottE said:
A few weeks ago, I was involved in a discussion about Office XP databases
that referenced the OL 10 library not automatically re-referencing to the OL
9.0 library when used on an Office 2k machine, and vice versa. The
discussion is a little lengthy or I'd repeat it here. You can find it by
clicking on search by author (ScottE), and it's the thread "Microsoft
Outlook 9.0 Object Library" beginning on 1/28/04 in m.p.a.modulesdaovba.
Here's my question. Disambiguation was one interesting solution that was
proposed. Here's another solution that works (so far), on which I'm
interested in your comments. I deleted the reference to any of the Outlook
libraries, changed all of the Outlook object-level variables to object (dim
ola as outlook.application changed to dim ola as object, etc), and changed
any constants to their actual values (olContactItem changed to 10, or
whatever the correct number is). Put another way, I late-bind the OL
variables instead of early-binding them. All OL-related functions still
work perfectly. I know it's said that early-binding is better (faster), but
the dismabiguation solution adds a lot of complexness. What are the
problems with the de-referencing solution?
 
Just to piggyback on this reply, for the OP:

Late binding also adds a severe performance overhead in certain cases. For
example, if you are automating a complex series of operations in MS Word.

The disambiguation approach is tricky, but you only have to do it in a
single module. All your other modules can be written in the normal way. And,
you can write a disambiguated standard module, where you just plug-in extra
code, depending on the references to be checked or corrected. So
disambiguation is only a "code once, re-use often" complication.

HTH,
TC
 
Back
Top