錯誤信息:000208D5-0000-0000-C000-000000000046
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: 程式庫未登錄。 (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).
重裝office,修復office,對此可能無效。
最終解決辦法,在注冊表中找到如下注冊項
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\TypeLib\{00020813-0000-0000-C000-000000000046}
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9
我電腦上裝的是office 2007,也就是1.6版本的庫,然而下面還有個1.9的,程序好像默認按照高版本的先識別,也就是優先識別1.9的,
但是我的電腦並未裝1.9 的office,於是刪除掉1.9的這一項,試了一下,問題解決。
或者把1.9改為1.6以下的,同樣可解決問題。其他版本以此類推

