Excel 2007 and Worksheet.UsedRange

Add-in Express™ Support Service
That's what is more important than anything else

Excel 2007 and Worksheet.UsedRange
 
M D




Posts: 11
Joined: 2007-03-29
Hi,

I get following exception when trying to get UsedRange property of a worksheet:

System.Runtime.InteropServices.COMException (0x80028018 - TYPE_E_INVDATAREAD): Old format or invalid type library.

What might be causing it? Thanks for help.
Posted 29 Mar, 2007 16:54:21 Top
M D




Posts: 11
Joined: 2007-03-29
I tried also Excel 2003 and get the same exception. Also tried XLToys sample and it does not work in Excel 2007 nor Excel 2003 - it always display message "Error occured in the code of add-in.".

Please, I need to sort the problem out as soon as possible. In six hours I've got to have something working. Thanks for help and understanding.

md
Posted 30 Mar, 2007 05:01:17 Top
M D




Posts: 11
Joined: 2007-03-29
I've forgotten to mention I'm on Windows Vista, if it makes a difference.
Posted 30 Mar, 2007 05:03:24 Top
M D




Posts: 11
Joined: 2007-03-29
Replying again to myself, I seem to have found the cause of problem. It's described in following article, already mentioned on this forum:

http://support.microsoft.com/kb/320369

Simply said, if Excel does not support language which is set in Regional setting of OS on which it is installed, the automation fails. In my case I've got English version of Excel without any Multilingual pack installed and Regional Settings of OS set to non-english language.

I've been able to temporarily solve the problem by setting English culture in add-in constructor like this:

Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo( "en-US" );

However this is not a long-term solution. I'm developing an add-in which should run on any combination of OS regional settings/Excel language version. Does Add-In Express somehow aid in solving this multi-culture problem? If not transparently (don't know whether it is possible), it could at least help in determining which cultures will work with the Excel which the add-in has been started in.

Thanks for ideas,
md
Posted 30 Mar, 2007 05:38:59 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi M D.

To get the current system culture you can use CultureInfo.CurrentCulture property.
To get the Excel localization you can use CultureInfo.CurrentUICulture property.


P.S. Note that we take up your forum requests in the order we receive them. Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 30 Mar, 2007 09:04:52 Top
M D




Posts: 11
Joined: 2007-03-29
Thanks for reply, Sergey. What would be the procedure to determine which cultures beyond CultureInfo.CurrentUICulture are supported in case Excel Multilingual User Interface pack is installed?
Posted 30 Mar, 2007 09:56:13 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
M D, I don't have 'Multilingual User Pack' installed on my PC so I can't test it.
Posted 30 Mar, 2007 10:19:23 Top