title: Save file dialog and export to Excel sheet
body: <p>I had a datagrid view, and I had exported to an Excel sheet. The code worked well, but when the <em>Save As</em> dialog appeared and saved the file I could not find the file and no error appeared.</p>
  <h3>My code</h3>
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      try
      {
          using (new ExcelUILanguageHelper())
          {
              SaveFileDialog saveFileDialog = new SaveFileDialog();
              saveFileDialog.Filter = &quot;Execl files (*.xls)|*.xls&quot;;
              saveFileDialog.FilterIndex = 0;
              saveFileDialog.RestoreDirectory = true;
              saveFileDialog.CreatePrompt = true;
              saveFileDialog.Title = &quot;Export Excel File To&quot;;
  
              Excel.ApplicationClass ExcelApp = new Excel.ApplicationClass();
              ExcelApp.Application.Workbooks.Add(Type.Missing);
              ExcelApp.Columns.ColumnWidth = 30;
              for (int i = 0; i &lt; DGData.Rows.Count; i++)
              {
                  DataGridViewRow row = DGData.Rows[i];
                  for (int j = 0; j &lt; row.Cells.Count; j++)
                  {
                      ExcelApp.Cells[i + 1, j + 1] = row.Cells[j].ToString();
                  }
              }
  
              ExcelApp.ActiveWorkbook.SaveCopyAs(saveFileDialog.ShowDialog());
              ExcelApp.ActiveWorkbook.Saved = true;
              ExcelApp.Quit();
          }
      }
      catch (Exception ex)
      {
          MessageBox.Show(&quot;Cancelled Operation&quot;);
          this.Close();
      }
  }
  </code></pre>