none
VB.NET - Excel Object Library

    Question

  • Hi,

    I am using VB.NET for a project and the system I am using contains the OfficeXP. In my project I'm referencing an Excel application to export data from the datagrid used in the forms. To reference the Excel application I'm adding a COM object Library which my system is displaying as "Microsoft Excel 10.0 Object Library". Using this Library the Export Module is working fine in my system. But when I install the same in the client machine who are using Office 2000. It is giving error message.

    How can I refer an "Microsoft Excel 9.0 Object Library" to my existing project?

    Thanks in Advance

    Kadiyala

    Tuesday, September 05, 2006 9:04 AM

Answers

  • Hi Kadiyala

    Please note that this forum targets the VSTO technology, and not general automation of Office applications or Add-ins. The "Please read first" posting at the beginning of this forum contains links for these tasks.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=174275&SiteID=1

    In this particular case, your question should be asked in the Office.Automation newsgroup, which you'll find listed there. I can give you a short answer about the problem you're running into: The reason your current solution isn't working is firstly because the target system doesn't have any IAs, or IAs for the wrong version (XP instead of 2000).

    1. Microsoft does not support creating a single solution for multiple versions of Office, although it can work under certain circumstances. Each Office version differs; a newer version will contain things an older does not support; a newer version may behave differently when using the same command.

    2. In order for a .NET app to communicate with an Office app (COM), a "translator" is required between the two interfaces. Such a translator is called an "Interop Assembly" (IA). For Office XP and 2003 Microsoft supplies optimized, proprietary PIAs (Primary IA). Each set of IAs is version-specific, although a newer version can often understand an older version's IA. It doesn't work the other way, however.

    3. Therefore

    • You should develop your application against the oldest version you plan to support
    • You need to obtain a set of Office 2000 IAs (preferably by using TlbImp.exe)
    • You need to distribute these IAs with your solution
    Tuesday, September 05, 2006 9:39 AM
    Moderator