none
Microsoft Excel 14.0 Object Library with Microsoft Excel 2007

    Question

  • I have written Visual Basic .NET application using Microsoft Excel 14.0 Object Library.

    I have Microsoft Office 2010 Installed on my machine, but my client using Microsoft Office 2007.

    Should I expect any difficulties installing the application on the client's machine, if so what should I do or be aware of?

    Or is there any way I could ad Microsoft Excel 2007 Object Library reference on my machine?

    Saturday, December 04, 2010 3:28 PM

Answers

  • I have written Visual Basic .NET application using Microsoft Excel 14.0 Object Library.

    I have Microsoft Office 2010 Installed on my machine, but my client using Microsoft Office 2007.

    Should I expect any difficulties installing the application on the client's machine, if so what should I do or be aware of?

    Or is there any way I could ad Microsoft Excel 2007 Object Library reference on my machine?


    Hi Igal

    Which version of Visual Studio did you use? If it's VS 2010 then you can program against Office 2010 applications and your code can run in earlier versions - as long as you use only features that are available in the earlier versions.

    By default, VS 2010 uses a new functionality that embeds the parts of the type library you use into your .NET project. This makes the project version-independent and PIA-independent.

    If you use VS 2008 or earlier, this is not available to you. In that case, what Dennis said applies.

    I also feel it's important to correct the statement made in this discussion that the object library is part of a *.exe file. It is not. The Office object libraries are in *.olb and *.tlb files. But a .NET project does not work with these directly, as these are COM. An "translation interface" is required for a .NET app to be able to communicate with COM, as they use different data types and some other things are different. These "translation interfaces" are called "Interop Assemblies" (IAs) and can be generated using the tlbImp.exe tool that's part of Visual Studio. In this case, the IAs need to be distributed with the solution. A software manufacturer can deliver an optimized set of IAs, called PIAs (Primary Interop Assembly). These are stored in the .NET GAC and are meant to be used by all developers and are what should be used in your Office projects.

    PIAs are version-dependent, but the Office 2007 and Office 2010 PIAs can recognize calls to Office 2003 PIAs and "re-route" these to themselves. So it's possible to bring projects programmed against earlier versions of Office forward to newer versions, but not vice-versa. If you want to program for multiple versions, you should therefore always program against the earlier version (and also because you can be sure that you aren't using any new features).


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bruce Song Wednesday, December 08, 2010 8:39 AM
    • Marked as answer by Bruce Song Thursday, December 09, 2010 9:53 AM
    Sunday, December 05, 2010 7:54 AM

All replies

  • the microsoft excel 14.0 object library is an .EXE file.  It is the excel program.  I opened excel and look in the VBA menu Tools - References which gave me the name of the library.

    C:\Program Files\Microsoft Office\Office12\Excel.exe

    I would think you would need to install Office 2007 on your machine to get the library.  But then office 2010 is meant to work with Window 7 which are both 64 bit machines.  Are they running window 7 on your clients PC?  I don't think you will be able to fully verify you application when you are running at one site a 64 bit environment and the 2nd site a 32 environment.


    jdweng
    Saturday, December 04, 2010 5:29 PM
  • Igal,

    You may consider to use late binding instead of early binding. In thay way Your VB.NET solution is not depended on which version of the PIAs that is installed on the targeting machines.

    Joel,
    The poster says it's VB.NET and You can read more about PIAs in the above link.


    Kind regards, Dennis (http://xldennis.wordpress.com/)
    Saturday, December 04, 2010 8:22 PM
  • I have written Visual Basic .NET application using Microsoft Excel 14.0 Object Library.

    I have Microsoft Office 2010 Installed on my machine, but my client using Microsoft Office 2007.

    Should I expect any difficulties installing the application on the client's machine, if so what should I do or be aware of?

    Or is there any way I could ad Microsoft Excel 2007 Object Library reference on my machine?


    Hi Igal

    Which version of Visual Studio did you use? If it's VS 2010 then you can program against Office 2010 applications and your code can run in earlier versions - as long as you use only features that are available in the earlier versions.

    By default, VS 2010 uses a new functionality that embeds the parts of the type library you use into your .NET project. This makes the project version-independent and PIA-independent.

    If you use VS 2008 or earlier, this is not available to you. In that case, what Dennis said applies.

    I also feel it's important to correct the statement made in this discussion that the object library is part of a *.exe file. It is not. The Office object libraries are in *.olb and *.tlb files. But a .NET project does not work with these directly, as these are COM. An "translation interface" is required for a .NET app to be able to communicate with COM, as they use different data types and some other things are different. These "translation interfaces" are called "Interop Assemblies" (IAs) and can be generated using the tlbImp.exe tool that's part of Visual Studio. In this case, the IAs need to be distributed with the solution. A software manufacturer can deliver an optimized set of IAs, called PIAs (Primary Interop Assembly). These are stored in the .NET GAC and are meant to be used by all developers and are what should be used in your Office projects.

    PIAs are version-dependent, but the Office 2007 and Office 2010 PIAs can recognize calls to Office 2003 PIAs and "re-route" these to themselves. So it's possible to bring projects programmed against earlier versions of Office forward to newer versions, but not vice-versa. If you want to program for multiple versions, you should therefore always program against the earlier version (and also because you can be sure that you aren't using any new features).


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bruce Song Wednesday, December 08, 2010 8:39 AM
    • Marked as answer by Bruce Song Thursday, December 09, 2010 9:53 AM
    Sunday, December 05, 2010 7:54 AM