I created two buttons that should open Word and Excel . Word opens, but Excel does not open. At first I wanted to open Word and Excel in one button, then I created a separate button. Here is the source code:

 private void OpenExcelAndWord_Click(object sender, EventArgs e) { Word.Application wordapp = new Word.Application(); wordapp.Visible = true; } private void buttonExcel_Click(object sender, EventArgs e) { Excel.Application excelapp = new Excel.Application(); excelapp.Visible = true; } 

Here is the error:

error opening Excel

  • Manually (not from the application) Excel opens? - default locale
  • Yes, it is. - Ismoil Muhammadiev
  • And you do not want to use Open XML or libraries based on it? As with Office COM Interop you suffer, besides there are problems with speed and memory leaks. I personally also had problems with versions. - Vadim Ovchinnikov
  • Can you show an example? - Ismoil Muhammadiev
  • How to connect ClosedXML? I downloaded from this site github.com/ClosedXML/ClosedXML - Ismoil Muhammadiev

1 answer 1

Most likely, one version of the office was installed on top of the other. I had this kind of problem.

Decided using this link.


  1. Open the Registry Editor (this can be done from the command line by typing regedit ).

  2. Then in the editor window under the computer icon, expand HKEY_CLASSES_ROOT , then TypeLib .

  3. Next, find the key {00020813-0000-0000-C000-000000000046} . If there is more than one folder (due to two installed versions), then one of them should be deleted. As far as I remember, I had folders 1.7 and 1.8, and when I deleted one of them, the problem was resolved.

Perhaps your problem can be solved by removing MS Office and then reinstalling it.