I have a newly-bought laptop. I installed it with Visual Studio 2013, Office 2013, and Project 2013. However, when I run my app, I have an error message:
{"Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' 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: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))."}
What could have caused this?
As Ken White mentioned in the comments, the Microsoft.Office.Interop files are not part of Office 2013 or Visual Studio. They must be downloaded and installed separately. You can download the files from Microsoft's website.
If you have already installed the Microsoft.Office.Interop package and you're still receiving this error, you may need to explicitly specify the location to these files so that your application can find them. See more information in this MSDN forums thread.
User contributions licensed under CC BY-SA 3.0