I am having troubles adding the excel reference to my project. I have already installed Primary Interop Assemblies.
The project is detecting the Microsoft.Office.Interop.Word assembly reference correctly but the excel reference still cannot be found.
When I try to manually add the reference, I right click the project, add reference, navigate to the Microsoft.Office.Interop.Excel file and try to add it manually. Once i select the reference I then make sure the reference is checked, then hit ok. Nothing happens, it fails to actually add the reference path to the project.
Using VS2012 Ultimate.
Any suggestions on what I can do to get the project to see the excel reference?
41686d6564
19.2k12 gold badges41 silver badges79 bronze badges
asked Oct 23, 2013 at 13:38
6
If you don’t have excel installed, run this command in the nuget-packet-manager-console:
Install-Package Microsoft.Office.Interop.Excel
answered Apr 14, 2017 at 14:51
Luca ZieglerLuca Ziegler
3,2961 gold badge23 silver badges39 bronze badges
I installed Microsoft office PIAs, but I had the same problem, cannot find microsoft.office.interop.excel dll, I also I installed Visual Studio 2010 Tools for the Office System 4.0 Runtime Service Pack 1 but still the problem persist.
Finally I resolve the problem with an add of Office / SharePoint development package to my Visual Studio 2017 installation:
Go to Tools > Get Tools and Features ..
And then check Office / sharepoint development and modify your installation.
answered Apr 4, 2018 at 15:03
1
I installed MS Office 13 and from then on I started getting this error in VS 2012 project.
I tried adding the MS Office lib via COM control but that didnt work.
Finally I had to add this library references from the «Extensions» section (not not under COM); had to select Microsoft.Office.Interop.Excel, version 15.0.0.0. That fixed the error.
Hope that helps some.
answered Apr 11, 2016 at 19:16
So I had to move a project to my dev machine from a consultant.
My working machine reference pointed to Microsoft.Office.Interop
My non-working machine wanted «Excel» to come from DocumentFormat.OpenXml.Spreadsheet which was also in the project.
I needed to
Tools>NuGet Package Manager>Package Manager Console and type «Install-Package Microsoft.Office.Interop.Excel»
then I needed to «Add Reference» as described above.
Movin to my co-worker’s machine we had to do these two steps and close and open the project to get it all to take.
answered Jun 23 at 15:29
aldookar 0 / 0 / 0 Регистрация: 10.02.2013 Сообщений: 60 |
||||
1 |
||||
11.02.2013, 00:22. Показов 37939. Ответов 10 Метки нет (Все метки)
Всем привет! Кто может подсказать мне как заставить работать это у строчку:
Ошибка «Имя типа или пространства имен «Office» отсутствует в пространстве имен «Microsoft»».
0 |
28 / 28 / 6 Регистрация: 25.12.2008 Сообщений: 186 |
|
11.02.2013, 01:47 |
2 |
Везде в интернете пишут что нужно добавить в Reference Microsoft.Office, но у меня студия на русском и я не могу понять куда это добавлять. В ссылки…
0 |
460 / 441 / 75 Регистрация: 26.12.2012 Сообщений: 2,885 |
|
11.02.2013, 10:27 |
3 |
вот на скрине видно в англоязычной версии вместо слова ссылка у вас будет написано references Миниатюры
1 |
0 / 0 / 0 Регистрация: 10.02.2013 Сообщений: 60 |
|
11.02.2013, 13:25 [ТС] |
4 |
Блин значит у меня чего то нет…
0 |
460 / 441 / 75 Регистрация: 26.12.2012 Сообщений: 2,885 |
|
11.02.2013, 13:51 |
5 |
на вкладке COM ищите Миниатюры
3 |
56 / 56 / 14 Регистрация: 06.04.2012 Сообщений: 185 |
|
11.02.2013, 13:54 |
6 |
Вкладка «Обзор», и далее — C:\Windows\Assemblies\GAC\Microsoft.Office.Interop.Excel и выберите нужную версию, это если у вас семерка, если ХР, то вроде бы понадобится установить PIA для вашей версии офиса(2003,2007), качается оно с сайта майкрософта (например для 2003 офиса — http://www.microsoft.com/en-us… x?id=20923), хотя, так как вам не просто использовать, а разрабатывать, то возможно еще понадобится(в случае ХР) установить VSTO
2 |
0 / 0 / 0 Регистрация: 10.02.2013 Сообщений: 60 |
|
11.02.2013, 14:12 [ТС] |
7 |
Спасибо! Дальше уже сам думаю разберусь.
0 |
0 / 0 / 0 Регистрация: 10.02.2013 Сообщений: 60 |
|
12.02.2013, 17:58 [ТС] |
8 |
Решил не создавать новую тему и написал здесь. Добавлено через 1 час 32 минуты
0 |
aldookar 0 / 0 / 0 Регистрация: 10.02.2013 Сообщений: 60 |
||||
17.02.2013, 17:02 [ТС] |
9 |
|||
Всем привет! Снова зашел в тупик…
Код записывает первую строчку в сетке, но не создает вторую… Добавлено через 2 часа 3 минуты Добавлено через 1 минуту Добавлено через 30 минут
0 |
Сосна15 13 / 12 / 1 Регистрация: 02.10.2017 Сообщений: 22 |
||||
02.10.2017, 16:27 |
10 |
|||
Всем привет! Кто может подсказать мне как заставить работать это у строчку:
Ошибка «Имя типа или пространства имен «Office» отсутствует в пространстве имен «Microsoft»». Столкнулся с той же проблемой. В русской ВидеоСтудии трудно понять куда заходить, чтобы установить компонент Экселя. Решение такое: В Обозревателе решений жмём правой кнопкой на свой проект, появляется окошко контекстного меню.
1 |
SeIZVeIZ |
02.10.2017, 16:52
|
Не по теме: Сосна15, на дату смотреть не учили?
0 |
I am having troubles adding the excel reference to my project. I have already installed Primary Interop Assemblies.
The project is detecting the Microsoft.Office.Interop.Word assembly reference correctly but the excel reference still cannot be found.
When I try to manually add the reference, I right click the project, add reference, navigate to the Microsoft.Office.Interop.Excel file and try to add it manually. Once i select the reference I then make sure the reference is checked, then hit ok. Nothing happens, it fails to actually add the reference path to the project.
Using VS2012 Ultimate.
Any suggestions on what I can do to get the project to see the excel reference?
41686d6564
19.2k12 gold badges41 silver badges79 bronze badges
asked Oct 23, 2013 at 13:38
6
If you don’t have excel installed, run this command in the nuget-packet-manager-console:
Install-Package Microsoft.Office.Interop.Excel
answered Apr 14, 2017 at 14:51
Luca ZieglerLuca Ziegler
3,2961 gold badge23 silver badges39 bronze badges
I installed Microsoft office PIAs, but I had the same problem, cannot find microsoft.office.interop.excel dll, I also I installed Visual Studio 2010 Tools for the Office System 4.0 Runtime Service Pack 1 but still the problem persist.
Finally I resolve the problem with an add of Office / SharePoint development package to my Visual Studio 2017 installation:
Go to Tools > Get Tools and Features ..
And then check Office / sharepoint development and modify your installation.
answered Apr 4, 2018 at 15:03
1
I installed MS Office 13 and from then on I started getting this error in VS 2012 project.
I tried adding the MS Office lib via COM control but that didnt work.
Finally I had to add this library references from the «Extensions» section (not not under COM); had to select Microsoft.Office.Interop.Excel, version 15.0.0.0. That fixed the error.
Hope that helps some.
answered Apr 11, 2016 at 19:16
So I had to move a project to my dev machine from a consultant.
My working machine reference pointed to Microsoft.Office.Interop
My non-working machine wanted «Excel» to come from DocumentFormat.OpenXml.Spreadsheet which was also in the project.
I needed to
Tools>NuGet Package Manager>Package Manager Console and type «Install-Package Microsoft.Office.Interop.Excel»
then I needed to «Add Reference» as described above.
Movin to my co-worker’s machine we had to do these two steps and close and open the project to get it all to take.
answered Jun 23 at 15:29
- Remove From My Forums
-
Question
-
Hi,
I’m going to create a simple Excel file and export data from a SQL server table and save it to the Excel file.
I have problem with creating Excel file getting the error for the following code:
Excellibrary.DataSetHelper.CreateWorkbook("test.xls", ds)
The error message is : The name «Excellibrary» does not exist in the current context.
Or
using (Excel = Microsoft.Office.Interop.Excel)
The error message is : The name «Excel» does not exist in the current context.
I’ve added References these to my project:
Microsoft.Office.Interop.Excel
Microsoft.Office.Tools.Excel
Is there any reference i should add? Please advise me what the problem is?
Thanks
-
Edited by
Tuesday, December 10, 2013 11:12 AM
-
Edited by
Answers
-
Hi Kate,
You can create Excel file by this code:
using Excel=Microsoft.Office.Interop.Excel; using System.Reflection;
public void CreateExcel( string fileName) { Object missing = Missing.Value; Microsoft.Office.Interop.Excel.Application m_objExcel = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbooks m_objWorkBooks = m_objExcel.Workbooks; Microsoft.Office.Interop.Excel.Workbook m_objWorkBook = m_objWorkBooks.Add(true); Microsoft.Office.Interop.Excel.Sheets m_objWorkSheets = m_objWorkBook.Sheets; ; Microsoft.Office.Interop.Excel.Worksheet m_objWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)m_objWorkSheets[1]; m_objWorkBook.SaveAs(fileName, missing, missing, missing, missing, missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, missing, missing, missing, missing, missing); m_objWorkBook.Close(false,missing,missing); m_objExcel.Quit(); }
Thanks.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.-
Marked as answer by
Kate es
Wednesday, December 11, 2013 9:02 AM
-
Marked as answer by
- Remove From My Forums
-
Question
-
Hello,
Can someone please tell me what is incorrect about this code? I have a reference to Excel 12 included in the project…
using Excel = Microsoft.Office.Interop.Excel; namespace Program { class Program { static void Main(string[] args) { Excel.Application app = new Excel.Application(); app.DisplayAlerts = false; } } }
results in the following error:
System.InvalidCastException was unhandled Message="Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' 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: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))." Source="Microsoft.Office.Interop.Excel" StackTrace: at Microsoft.Office.Interop.Excel.ApplicationClass.set_DisplayAlerts(Boolean RHS) at RefreshHelper.Program.Main(String[] args) in C:\Users\user\Desktop\program\program\Program.cs:line 20 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
Thanks,
Dup-
Edited by
Tuesday, November 3, 2009 10:10 PM
-
Edited by