Skip to main content

Error loading type library/DLL (Microsoft.Office.Interop.Excel.Application)

I was struggling with this error for a few days . It came out after I’ve upgraded my project to Visual Studio 2012.

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: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

It shows up while it’s the time for Excel operations:

WeDem

Workaround:

It occurs because I’ve installed Office 2013 instead of Office 2010 which I was using with old version of my project. After I upgraded my Office, the project was no longer able to link Excel reference.

Even though I referenced new Excel library which is 15.0, it didn’t work.

Solution:

  • Delete the Excel reference (Microsoft.Office.Interop.Excel). Version 15.0, in my case.
  • Install Microsoft Excel (whichever version you had been using. Version 2010 for me)
  • Add the Excel reference (older one. Version 14.0, in my case)

Long story short: Never take more than one risk at the same time!

If the main form doesn’t show up when you run the project (Visual Studio)

After upgrading a project to newer version of Visual Studio, you might face this problem: your main form may not show up when you run the application either in debug mode or release mode.

This problem might cause because of the database connection but there will probably no error or warning. So, the trick is that:

  • Go to “Project > Properties > Build
  • Change “platform target” to “x86
  • Run your application again. It will give the actual error message
  • Don’t forget to change “platform target” to “Any CPU” after taking caring of the problem (If this setting is what you want)

How to install any package on a Linux without internet? (offline installation)

It is kind a tricky situation. If you want to install a package on your Linux, you might use Software Center or command prompt. It fetches and install the package via internet for you. What if you don’t have the internet?

Steps are simple:

  1. Get the package somehow 
  2. Give the command by pointing offline package file

This is an example of installing SSH on Ubuntu 12.10 offline.

  • In order to have offline installation file, follow this command:
sudo apt-get --download-only openssh-server

image

  • Install it by using deb file:
sudo dpkg -i /home/name/Desktop/ssh.deb

image2

You can use the similar steps for almost any kind of packages!