Solved

How to avoid COMException when getting value of an Excel 2007 cell?

Posted on 2010-09-02
2
774 Views
Last Modified: 2013-11-10
Hello,

I'm developing an add-in for Excel 2007 with Visual Studio 2005, and I don't have any errors when I use it on my machine, but I'm getting following errors on another computer:
 Exception thrown when getting cell value
This error occurs when getting value of a cell:
 
Excel.Range rng = sheet.Cells[headidx, icol] as Excel.Range;
                if (rng != null)
                {
                    object val = rng.get_Value(oMissing);
                }

Open in new window


Would you have any idea about the origin of the problem and how to solve it?

Many thanks,
Julien
0
Comment
Question by:JulienVan
  • 2
2 Comments
 
LVL 2

Author Comment

by:JulienVan
ID: 33586141
I've found an element of answer on this site: http://www.tebyan.net/index.aspx?pid=31159&BookID=22108&PageIndex=44&Language=3

"Old Format or Invalid Type Library Error

A second issue that further complicates the Excel locale issue is that you can get an "Old format or invalid type library" error when using the Excel object model in an English Excel installation on a machine where the locale is set to a non-English locale. Excel is looking for a file called xllex.dll in Program Files\Microsoft Office\OFFICE11\1033 that it cannot find. The solution to this problem is to install the xllex.dll file or install the MUI language packs for Office. You can also make a copy of excel.exe, rename it to xllex.dll, and copy it to the 1033 directory."

The origin of the problem might be that my system is not in english but my Office software is, I'm going to check it...
0
 
LVL 2

Accepted Solution

by:
JulienVan earned 0 total points
ID: 33586628
OK so the origin of the problem was the locale culture that was different from Excel language, as explained here:
http://blogs.msdn.com/b/vsto/archive/2009/07/06/bug-old-format-or-invalid-type-library-error-when-automating-excel-christin-boyd.aspx
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Convert .PDF 6 42
COnsume rest client 6 11
Need Excel VBA Macro to Assign Two Digit Numbers to List 10 13
Birthdays 3 0
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now