title: Delete Excel Chart
body: <p>I want to delete a Chart from an Excel file.
  The Excel file is an automatically generated historyfile with a chart, the problem is, that every time I renew the history, it makes a new chart, but the old one must be deleted...
  This is my code:</p>
  <pre><code>Excel.Workbook ExcelWorkBook = ExcelApp.Workbooks.Open(path);
  ExcelApp.Visible = true;
  Excel.Worksheet Sheet = (Excel.Worksheet)ExcelWorkBook.Worksheets.get_Item(1);
  Excel.Range range = Sheet.UsedRange;
  int i = 2;
  while (Convert.ToString((range.Cells[i, 1] as Excel.Range).Value2) != null)
  {
      i++;
  }
  
  Excel.Range oRange;
  Excel._Chart oChart;
  Excel.Series oSeries;
  oChart = (Excel._Chart)ExcelWorkBook.Charts.Add(Missing.Value, Missing.Value,
  Missing.Value, Missing.Value);
  oRange = Sheet.get_Range(&quot;A2:H&quot; + i).get_Resize(Missing.Value, 8);
  oChart.ChartWizard(oRange, Excel.XlChartType.xlLineStacked, Missing.Value,
  Excel.XlRowCol.xlColumns, Missing.Value, Missing.Value, Missing.Value,&quot;Chart01&quot;);
  oSeries = (Excel.Series)oChart.SeriesCollection(1);
  oSeries.XValues = Sheet.get_Range(&quot;A2&quot;, &quot;A&quot; + i);
  oChart.Location(Excel.XlChartLocation.xlLocationAsObject, Sheet.Name);
  </code></pre>
  <p>Now I need to delete the existing Chart before that code.</p>
  <p>Something like</p>
  <pre><code>Excel._Chart asdf = Sheet.ChartObjects(&quot;Chart01&quot;).Chart;
  if (asdf != null)
  {
      asdf.Delete();
  }
  </code></pre>
  <p>This doesn't find a chart with name &quot;Übersicht&quot; but there is a chart with title &quot;Übersicht&quot;</p>
  <p>EDIT:
  The Problem now is that it can't delete the Chart: <em>Exception from HRESULT: 0x800A03EC</em></p>