title: Error accessing Names in Excel using Interop
body: <p>I am programming an application in C# (Visual Studio 2015) and I need to update an .xlsm file.</p>
  
  <p>This file has many formulas, over 1200 names and vba code.</p>
  
  <p>I am using the Interop library and I am able to update some cells and get the relative updated formulas but i have some problem with the Names defined in the Excel.
  The program recognizes the names in the Names collection but doesnt let me access some of the names.</p>
  
  <p>When I try to access the value of the cell using its name it produces an exception. 
  I dont understand why i can access some of the names and others no.</p>
  
  <p>Besides, in the excel, I can see the Name in the combo but when I select it, the cursor doesn't position over the cell. </p>
  
  <p>In my program I could avoid this problem accessing the cells using the reference instead of the Name, but the vba in the excel uses the names and if i open the file from my app it doesnt work.</p>
  
  <p>I am using this code:</p>
  
  <pre><code>excelApplication = new Microsoft.Office.Interop.Excel.Application();
  excelApplication.ScreenUpdating = true;  
  excelApplication.Visible = true;
  excelApplication.DisplayAlerts = false;   
  excelWorkbook = excelApplication.Workbooks.Open(txtFicheroEntrada.Text);
  wsDatos = excelWorkbook.Worksheets[1];
  wsDatos.Select();
  
  foreach(Microsoft.Office.Interop.Excel.Name v in excelWorkbook.Names)
  {
      string NombreVar = v.Name;
      //here i found the name BobinadoAT correctly. It exists
      if (NombreVar == "BobinadoAT" ){ Console.WriteLine(NombreVar); }
  }
  
  if (wsDatos.Range["BobinadoAT"] != null) //but here this produces an exception 
  {
  string valorcelda = wsDatos.Range["BobinadoAT"].Value.ToString();
  }
  </code></pre>
  
  <p>¿does anyone work with many excel Names? 
  ¿Am I accessing the names incorrectly?</p>