0

Microsoft.Office.Interop.Excel in the Component Name list is missing on the Assemblies page.

I need to include that:

using Microsoft.Office.Interop.Excel;

But it throws error: The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

And I can't find it in References either.

mybirthname
  • 17,949
  • 3
  • 31
  • 55
Totallama
  • 418
  • 3
  • 10
  • 26

2 Answers2

1

Try installing interop package from microsoft depending on your version of excel.

Then check if the microsoft excel 12.0 library will be on your reference.

See if it helps.

GNMercado
  • 433
  • 5
  • 9
  • unfortunately it doesn't work. I tried installing both o2007pia and o2010pia and nothing happened.. – Totallama Oct 19 '16 at 07:20
  • Did you try looking at your visual studio if there are any references being added? – GNMercado Oct 19 '16 at 07:24
  • Try manually adding the reference to your visual studio. Locate the directory where your package is. Then look for microsoft office folders. I have not done it because installing / reinstalling interop package perfectly works for me. – GNMercado Oct 19 '16 at 07:30
  • But I can't get the actual file o2010pia.msi, I only managed to download the installer o2010pia and it doesn't work.. I don't know where I can download the actual o2010pia.msi – Totallama Oct 19 '16 at 07:34
  • It is the actual installer, try opening it with other applications or if there are any files associated with it. – GNMercado Oct 19 '16 at 07:38
  • Ok, but I am trying to add it and it doesn't work. It says: A reference to 'C:\path\o2010pia.msi' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component. – Totallama Oct 19 '16 at 07:47
  • It seems that the default extension to the reference is: .dll, .tlb, .olb, .ocx, .exe, .manifest – Totallama Oct 19 '16 at 07:50
  • It sounds strange, msi are file extensions for microsoft installers. You just need to click it then it will automatically run. – GNMercado Oct 19 '16 at 08:01
  • Sorry, I didn't know it was supposed to be in the COM tab, now I found it there. It works, tnx! – Totallama Oct 19 '16 at 08:06
0

On the Assemblies page, select Microsoft.Office.Interop.Excel in the Component Name list. If you do not see the assemblies, you may need to ensure they are installed and displayed (see How to: Install Office Primary Interop Assemblies) [https://msdn.microsoft.com/en-us/library/kh3965hw.aspx][1]

venkat
  • 52
  • 5