![error](https://i-blog.csdnimg.cn/blog_migrate/5c15665bfb601f5b99916fed5bd408af.bmp)
问题描述:
这个问题产生的原因,与 office 的安装有关。
参考:How to solve “Unable to cast COM object of type Microsoft.Office.Interop.Excel.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Excel._Application’”
文中碰到的问题就是安装了 office 2007,又安装了 office project 2010,在程序运行时,本应执行 HKCR\TypeLib\{00020813-0000-0000-C000-000000000046}\1.6
,却去访问了 HKCR\TypeLib\{00020813-0000-0000-C000-000000000046}\1.7
。
解决方法:
- 删除注册表中的项
HKEY_CLASSES_ROOT\TypeLib\{00020813-0000-0000-C000-000000000046}\1.7
![打开注册表](https://i-blog.csdnimg.cn/blog_migrate/b7f87f52fd43dd21bbbbc95ea3e33c11.png)
![删除注册表项](https://i-blog.csdnimg.cn/blog_migrate/86ccfafc229f6aa7610d48df1abd9d3b.png)