11

Visual Studio 2015 is giving me an error stating that the "Namespace or type specified in the Imports 'Microsoft.Office.Interop.Excel' doesn't contain any public member or cannot be found." I just started getting this error after upgrading to Office 2016 from 2013.

I don't have a .NET tab in my References section to add this reference. MSDN is only giving me an option to download the Primary Interop Assembly for Visual Studio 2013 and it is not fixing my issue. I still don't see the .NET tab.

How do I fix these reference errors?

Fly Guy
  • 245
  • 1
  • 4
  • 10
  • 1
    You have to add a reference to the given Excel Object Library in your project. If the way to do it in VS 2015 is different than so far, you should do some research to know the new approach. Or you might just find the given file and attach it to your project manually (as any other dll). Note that the Primary Interop Assemblies are not required since Office 2007 and were meant for the target computer (to allow the application to run), not to include the Excel namespace in the project. – varocarbas Oct 19 '15 at 17:27

2 Answers2

8

With Office 2016 we can now add a reference again.

Delete your existing Microsoft.Office.Interop.Excel reference.

Right click references, add reference

Select COM Search for Excel Check Microsoft.Office 16.0 Object Library Click OK

Michael Ribbons
  • 1,170
  • 1
  • 12
  • 22
2

At the Moment there's no Office 2016 PIA. You have to reinstall Office 2013 and use that Office 15 PIA 'til Microsoft has released the Office 2016 PIA.

cbehh
  • 31
  • 5
  • Is there some easy way to get to know, if they will be released? Thank you, your information already helped me a lot :) – BendEg Nov 19 '15 at 08:37
  • 2
    The last post for this topic is quite old now... any update about those Office 2016 PIA? I can't find any references about it... – Vincent Aug 30 '16 at 14:01