Solved

MS Excel 12.0 Object Library not found in user PC

Posted on 2010-09-20
7
1,045 Views
Last Modified: 2012-05-10
Situation:
I have a program developed in Visual Studio 2005.  I have MS office 2007 installed in my XP computer, and I add reference to MS Excel 12.0 Object Library.
The program runs fine at my computer, however an error message pops up on users PC, which has MS office 2003 only.  The error message states MS Excel 12.0.0.0 Object Library is not found.

Question:
Is there anyway to work around this?
I did some research and some ppl talked about detecting the assembly and add the reference at runtime.  Is there any code for reference?
0
Comment
Question by:mishelper
7 Comments
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 500 total points
ID: 33714846
you can go late bound (no reference in your application, everything declare as object).
you can also (what I prefer) use a 3rd party components like http://www.aspose.com/categories/.net-components/aspose.cells-for-.net/default.aspx
0
 
LVL 18

Expert Comment

by:Cluskitt
ID: 33714851
On computers where you have excel 2003, open them and add the Excel 11 reference instead. It should work, unless you're using any function that was added for 2007 only.
0
 

Author Comment

by:mishelper
ID: 33715177
Thank you emoreau, is there any sample code you can share?

Than you Cluskitt, I cannot compile the program with your suggested way.  Visual Studio doesn't allow me to declare Excel objects as the reference is not found at my PC (developer PC)... I just cannot compile.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 18

Expert Comment

by:Cluskitt
ID: 33715210
Yes, I know. I didn't read your question right, my bad. :P

As for code, see here to explain differences between late and early binding: http://www.dicks-clicks.com/excel/olBinding.htm
0
 
LVL 84
ID: 33715293
<No points wanted>

If you must support users with Excel 11.0, then you must either (a) do as emoreau suggests and use Late Binding or (b) do your final build on a machine that is representative of the minimum supported environment (i.e. a machine with Excel 11.0 installed). Option (a) is the preferred method.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 33715399
0
 
LVL 41

Expert Comment

by:graye
ID: 33717245
Or you could just deploy the Office 2007  Primary Interop Assemblies (PIA) along with your application.   That will put the missing Excel 12.0 Object Library on the PC
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&displaylang=en 
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question