Excelファイルのデータをインポートしたり、Excelを使って印刷したりするアプリケーションでえらーがでた。System.Runtime.InteropServices.COMException (0x80028018): Old format or invalid type library.
System.Runtime.InteropServices.COMException (0x80028018): Old format or invalid type library.
このエラーが出たときの対応方法について簡単にメモ。
1.Excelが32bit版かを確認
Excelは32bit版でないとダメだとか。

確認は「ファイル > アカウント > EXCELのバージョン情報」でできます。
2.リージョンを確認
今回の件はこれでした。
Windows11、Office2024共に英語版を使用してセットアップしました。
セットアップ完了だと思ってテストしたら上記エラーです。

Windowsスタートメニューボタン > 設定 > 時刻と言語 > 言語と地域 を開いて「国または地域」の欄が「Japan」になっていました。
なぜだ~~~!
ここを「United States」に変更し、念の為再起動して試したら動作してくれました。
【参考】

Microsoft.Office.Interop.Excel doesn't work on 64 bit
I've encountered a problem when developing on MS Visual Web Developer 2008 Express Ed.Developing ASP.NET C# on Windows7 ...
BUG: "Old format or invalid type library" error when automating Excel - Microsoft Support
Describes an Error: 0x80028018 (-2147647512) that may occur when you automate Excel by using Visual Studio .NET and you ...
コメント