Office Object Library References - Dynamic changes

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

Is it possible to have references in your project changing dynamically when
working with different versions of MS Office. That is, if you are dependent
on the "Microsoft Office 11.0 Object Library" and then want to use the
application on a workstation with the Office 10 ["Microsoft Office 10.0
Object Library"], how can you ensure that you project picks this up or do
you have to compile different versions of your application for the different
versions of Office. We are currently using VB6. The libraries are normally
referenced using the menu item Project -> References.

Thanks in advance
 
I think you want to use something called late-binding. Instead of relying on a
specific version, you create a "version-independent" object that doesn't use
references.

Tom Ogilvy posted this recently:

Here are some more extensive references on binding:

Use late binding - don't have a reference to excel.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;244167
INFO: Writing Automation Clients for Multiple Office Versions

http://support.microsoft.com/default.aspx?scid=kb;en-us;245115
INFO: Using Early Binding and Late Binding in Automation

http://support.microsoft.com/default.aspx?scid=kb;en-us;247579
INFO: Use DISPID Binding to Automate Office Applications Whenever Possible

However, if the problem is caused by going from a newer version of Excel to
an older version, the solution might be to do the development on the oldest
version.

=============

Also, Dick Kusleika has a web page at:
http://www.dicks-clicks.com/excel/olBinding.htm
that explains this difference when using Outlook

It's very nice to use early binding when developing. You get all the
intellisense help (when you set the reference and declare the variables
nicely). But before you distribute it to users (who may be using different
versions), it's usually a good idea to use latebinding (and change those object
variable declarations to the generic "As Object".)
Is it possible to have references in your project changing dynamically when
working with different versions of MS Office. That is, if you are dependent
on the "Microsoft Office 11.0 Object Library" and then want to use the
application on a workstation with the Office 10 ["Microsoft Office 10.0
Object Library"], how can you ensure that you project picks this up or do
you have to compile different versions of your application for the different
versions of Office. We are currently using VB6. The libraries are normally
referenced using the menu item Project -> References.

Thanks in advance
 
Thanks Dave


Dave Peterson said:
I think you want to use something called late-binding. Instead of relying on a
specific version, you create a "version-independent" object that doesn't use
references.

Tom Ogilvy posted this recently:

Here are some more extensive references on binding:

Use late binding - don't have a reference to excel.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;244167
INFO: Writing Automation Clients for Multiple Office Versions

http://support.microsoft.com/default.aspx?scid=kb;en-us;245115
INFO: Using Early Binding and Late Binding in Automation

http://support.microsoft.com/default.aspx?scid=kb;en-us;247579
INFO: Use DISPID Binding to Automate Office Applications Whenever Possible

However, if the problem is caused by going from a newer version of Excel to
an older version, the solution might be to do the development on the oldest
version.

=============

Also, Dick Kusleika has a web page at:
http://www.dicks-clicks.com/excel/olBinding.htm
that explains this difference when using Outlook

It's very nice to use early binding when developing. You get all the
intellisense help (when you set the reference and declare the variables
nicely). But before you distribute it to users (who may be using different
versions), it's usually a good idea to use latebinding (and change those object
variable declarations to the generic "As Object".)
Is it possible to have references in your project changing dynamically when
working with different versions of MS Office. That is, if you are dependent
on the "Microsoft Office 11.0 Object Library" and then want to use the
application on a workstation with the Office 10 ["Microsoft Office 10.0
Object Library"], how can you ensure that you project picks this up or do
you have to compile different versions of your application for the different
versions of Office. We are currently using VB6. The libraries are normally
referenced using the menu item Project -> References.

Thanks in advance
 
Back
Top