"old format or invalid type library"

1.8k views Asked by At

We have an application that, amongst many other things, has an export to Excel function. This uses the Excel COM interface and simply exports some data to a new sheet in Excel and formats it to look like where it came from. For years we known that if the machine locale is set to something different to what Office was installed under that an "old format or invalid type library" will arise. However, under Excel 2003 it was possible to download and install a MUI (multi-language user interface) pack to fix the problem. With Excel 2007 and later there does not seem to be the equivalent pack - there are language packs (we downloaded a 7GB pack from MSDN for Office 2007) but these either don't work (setup.exe is "corrupted"), or don't work in the sense that we still get the "old format or invalid type library" problem.

Does anyone know if there is a pack for Office 2007 and Office 2010 that will definitely solve this problem, and where to get it from?

Alternatively, there is an MS link (http://support.microsoft.com/default.aspx?scid=kb;en-us;Q320369) that shows some code (in VB.Net I think) which purportedly sets the culture temporarily to "en-US" before doing stuff in Excel, then sets it back. I am sceptical about this solution because it seems to assume that the original Office installation would always be "en_US". What if it was Swiss German? Has anyone ever successfully used this approach, and have they ever done in win32 Delphi, and can you share a few code snippets?

1

There are 1 answers

4
David Heffernan On BEST ANSWER

The correct solution is to pass LOCALE_USER_DEFAULT whenever you call a method that expects an LCID. What are you passing to such functions?

If you do that then you don't need any of this MUI magic.