View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Maintaining Maximum Platform Compatibility

There are two aspects to compatibility. One is that Excel has changed over
the years and new features have been added. This means that code writen for
the current version of Excel may not work on older versions. You are best off
to write to the lowest version of Excel possible. The one are that can cuase
difficulty is code for Pivot Tables as teh Pivot Table Engine changed in
xl2002 and the code is different for the different versions.

The other issue (that I thing you are alluding to) is the compatibility of
references. This gets into early or late binding. Early binding is Selecting
Tools - References and binding a reference to your project at design time.
The other method is late binding where you create your reference to the
library at run time. Early binding makes the code run a tad faster and it
allows you to use the intellisence while coding (a very handy feature). Late
binding has the advantage of not being tied to a specific instance of a
reference. Check out these two examples...

Sub EarlyBinding()
'Must Reference Word Lilbrary (9.0, 10.1, 11.0, ...)
Dim appWord As Word.Application

Set appWord = New Word.Application
appWord.Visible = True
End Sub

Sub LateBinding()
Dim appWord As Object

Set appWord = CreateObject("Word.Application")
appWord.Visible = True
End Sub

If you can not guranatee which references an end user system will have then
late binding is great. Speed is not usually too big of an issue with late
binding. I find the loss of intellisence to be a bit of an issue. I will
normally reference the project to the library right up front and write my
code assuming early binding. When the code is up and running I will then
switch it to late binding (a little bit of rewrite but usually not too bad).
--
HTH...

Jim Thomlinson


"Bob the Kart Racing fool" wrote:

I am just learning about all the issues associated with maintaining
compatibility between different software years, discovered when I sent the
completed file to my boss for approval€¦ low and behold, a reference error.
So now, trying desperately to gather my pride from the floor, I come to you
because this forum has helped me so much in the past two weeks.

I need to maintain compatibility of my excel 2003 document that I have
created. I need it to work on Office 2000 and up. I have read all the posts
that I can find about €śbinding€ť but, I still dont understand how to use this
to automatically maintain my files compatibility. How is this code written
and implemented? If the file is saved, and opened again on an earlier
version of excel€¦ will it still work?

I desperately need guidance€¦

Thank you for your help in advance!

~Josh