View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Portability of early bound code - clarification

Hi Pete,

I'm not Chip Pearson, but FWIW, I agree with Tom. For development, Early
Binding is great because you get Intellisense, the Object Browser, etc. And
I use it when I *know* the environment will be a controlled one. For
example, a developer in an internal IT department may be able to count on
the fact that everyone will have Outlook 2002 installed. In that case,
Early Binding may be the way to go, as it is faster than Late Binding.

But in a distributed application or when you can't be sure that all users
will be using the same version of a library, Late Binding is the best choice
IMO; you can trap runtime error 429, which occurs if the user doesn't have a
particular library on his/her machine. With Early Binding, the user gets an
untrappable (read: ugly) error.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Pete McCosh wrote:
All,

I'm having a few problems getting something clear in my
mind and I hope someone can help.

From my limited experience with VBA and from searching for
help on this it would seem that there's no doubt I should
be early-binding when creating new objects in my code. If
Chip Pearson says "there is never a good reason for not
using early binding", then that's good enough for me. If
necessary, I set a reference to the appropriate library
and off I go!

The problem arises when I try to get another user to
access the same application: it falls over on the
Outlook / VBscript / whatever specific references.
Obviously I can get the user to set a reference manually,
but that would seem to be an admission of defeat.

I thought I might be missing something simple: maybe the
reference is specific to the project, but a simple
experiment disproved that theory.

Every previous article I can find simply re-iterates the
same thing. Always use early-binding.

What am I missing?

Pete