Microsoft.Office.Interop.Excel Reference Cannot be found (C#)

Alexandre Dantas 40 Reputation points
2024-01-15T13:52:09.99+00:00

Basically, i wrote a program on Visual Studio that uses Microsoft.Office.Interop.Excel, i added the reference for this directive using NuGet, but i catch this error:

System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral,

Trying to solve the problem, i searched for the Microsoft.Office.Interop.Excel.dll, and add the reference my self using the dll file, but i get the same error.

System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=16.0.0.0, Culture=neutral, 

I don't know why this error occurs. I've already add the reference to Microsoft Office 16.0 Object, but still the same.

Developer technologies | C#
{count} votes

Accepted answer
  1. Anonymous
    2024-01-16T01:48:21.06+00:00

    Hi @Alexandre Dantas , Welcome to Microsoft Q&A,

    In general, if you want to use Microsoft.Office.Interop.Excel, you need to add operations through Com.

    Create a .Net Framework project, add the following to the Reference: User's image

    Just find the excel dll in the com list.

    User's image

    For more information on the use of this dll, please refer to the official documentation: How to access Office interop objects

    Best Regards, Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Arama, Petru 0 Reputation points
    2024-08-19T12:16:42.1733333+00:00

    Hi, is there any way to do the same on VSCode?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.