none
Microsoft Excel 11.0 Object Library <The system cannot find the reference specified>

    Question

  • Hello,

    I am trying to add a reference to a VB.NET program to allow me to transfer data to Microsoft Excel 2003. I am programming on two machines (work & home). Both are running XP Pro, Visual Studio 2005 & Office 2003.

    On the work machine I have sucessfully added the Microsoft Excel 11.0 Object Library and Microsoft.Office.Interop and the program works fine. However on the home machine I am getting the following message in the resourse panel:

    <The system cannot find the reference specified>

    I have tried removing the reference from the resourses on the home machine and adding it again but always with the same affect.

    I have two queries.

    Does anyone know how to solve this please?

    and

    Once fixed and compiled into an executable program and sent out to end users could they potentially have the same problem I am having even though they are running a valid version of Excel?

    Can anyone help please? Thanks

    Tuesday, August 10, 2010 8:49 AM

Answers

  • Hi Garth

    Do you know which edition  of Office 2003 you have installed at home? If you're using VSTO (that's an assumption on my part, since that's the name of this forum), then Office 2003 Professional or "better" is required.

    If this is a WinForms, Console app or something similar, then the edition shouldn't matter.

    In that case, you want to make sure the necessary PIAs are installed in the GAC. Go to the Control Panel, start the applet for managing programs and software ("Add and Remove software" in Win XP, as I recall), select the entry for Office 2003 then choose a "custom" type of install. Select the branch for Excel and click the "+" to get the various options. Make sure the one for .NET programming support is activated to run from your machine. Do the same in the category for shared Office components, as well as any other Office applications you might develop against. Then let SETUP run (be sure you have your CD handy).


    Cindy Meister, VSTO/Word MVP
    Tuesday, August 10, 2010 1:31 PM

All replies

  • Hi Garth

    Do you know which edition  of Office 2003 you have installed at home? If you're using VSTO (that's an assumption on my part, since that's the name of this forum), then Office 2003 Professional or "better" is required.

    If this is a WinForms, Console app or something similar, then the edition shouldn't matter.

    In that case, you want to make sure the necessary PIAs are installed in the GAC. Go to the Control Panel, start the applet for managing programs and software ("Add and Remove software" in Win XP, as I recall), select the entry for Office 2003 then choose a "custom" type of install. Select the branch for Excel and click the "+" to get the various options. Make sure the one for .NET programming support is activated to run from your machine. Do the same in the category for shared Office components, as well as any other Office applications you might develop against. Then let SETUP run (be sure you have your CD handy).


    Cindy Meister, VSTO/Word MVP
    Tuesday, August 10, 2010 1:31 PM
  • That worked perfectly thank you.

    Can you help with the second question?

    Once this is finished stand-alone program, will it work on machines that, like mine, need the .NET programming support to be re-activated?

    Please let me know

    Thanks again.

    Tuesday, August 10, 2010 2:39 PM
  • Hi Garth

    Yes, the PIAs need to be installed in order for a .NET program to be able to communicate with a COM Office program. (The option installs the PIAs)

    A PIA "translates" between the COM type libraries (*.olb) of the Office applications and .NET. But you can include the PIAs in your setup, so that they install if required. There's a download available on microsoft.com with the distributable PIAs.

    The only way you would not require the PIAs is if you'd use late-binding in your code. Then you do not need references to the Office applications. But this also means you would not have Intellisense to help you with your coding.

    Since you're using VB.NET, late-binding can be done fairly simply. Make sure you have Option Strict Off (not On) at the top of your project. Once you're finished coding, change all your declarations to the data type "Object". For example, instead of Dim ws as Excel.Worksheet you have Dim ws as Object. All usages of Enums will have to be changed to their numerical value.

    After you've done this, delete the references to the Excel and Office applications. Now your code should be version-neutral.


    Cindy Meister, VSTO/Word MVP
    Tuesday, August 10, 2010 3:49 PM