title: Using Excel Interop and getting a print dialog
body: <p>I have the following code:  [Thank you Mike Rosenblum!]</p>
  
  <p>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using Microsoft.Office.Interop.Excel;
  using System.Runtime.InteropServices;</p>
  
  <p>namespace ConsoleApplication17
  {
      class Program
      {</p>
  
  <pre><code>    static void Main(string[] args) {
  
  
  
      //public void PrintMyExcelFile() 
      //{
  Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
  
  // Open the Workbook:
  Microsoft.Office.Interop.Excel.Workbook wb = excelApp.Workbooks.Open(
      @"C:\hello.xls",
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
      Type.Missing, Type.Missing,Type.Missing,Type.Missing);
  
  // Get the first worksheet.
  // (Excel uses base 1 indexing, not base 0.)
  Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets[1];
  
  // Print out 1 copy to the default printer:
  ws.PrintOut(
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
      Type.Missing, Type.Missing, Type.Missing, Type.Missing);
  
  
  
  
  // Cleanup:
  GC.Collect();
  GC.WaitForPendingFinalizers();
  
  Marshal.FinalReleaseComObject(ws);
  
  wb.Close(false, Type.Missing, Type.Missing);
  Marshal.FinalReleaseComObject(wb);
  
  excelApp.Quit();
  Marshal.FinalReleaseComObject(excelApp);
  
  
  
  }
      }
  
  
  
  
      }
  </code></pre>
  
  <p>What i'm trying to accomplish is that instead of this printing my excel file right away, I'd like a print dialogue to appear so that I may choose a specific printer if i'd like.<br>
  I'm using the 12.0.0.0 .NET interop for Excel.
  Anybody have any ideas?</p>
  
  <p>Thanks in advance</p>