View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Converting to late binding (for compatibility)

Not if you are already working in Excel.

Late binding is used when accessing an application from within another
application.

For instance, say you wanted to run some code that gets data from a
spreadsheet, and wants to write some of it to a Word document. You would
need to either start Word, or connect to a running instance of Word, from
within your (Excel) VBA code. You have the choice of using early binding
here, which means that you set a reference to the Word object library from
within your Excel VBA code. By connecting early, the code has the advantage
of being able to provide intellisense on any Word objects that you may use
in the code, and can resolve those references at compile time.

The problem comes if you have a reference to say Word 2003, and someone else
has Word 2000 on their machine. They open your Excel workbook with the code,
and it fails. Late binding can overcome this as by not setting the
reference, the type library is looked up at run time (it looks in the
registry to see what version is available). This means that you don't get
Word intelli-sense, and it is much less efficient, and as every time it
comes across a Word object, property, method, it has to go to the type
library and check that it is valid, and the usage is valid.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



wrote in message
ups.com...
Bob,

Ah - see, this is what I was trying to get my head around. So if I
was only referencing the Excel type library, there would be no need to
rework the spreadsheet for backwards compatibility?

Best regards,

Tristan