title: How do I "sheetwise" save or export an Excel workbook as a PDF file?
body: <p>The problem with the code I have is that either it saves all the pages in all the worksheets in the workbook or it saves only the pages in the range specified by the "from" and "to" arguments.</p>
  
  <p>The excel files I am working with have 7 worksheets, and each worksheet can have any amount of pages. If I specify that I want to export "from 1 to 4", for example, then only the first 4 pages of the first worksheet would be exported as a PDF document, not all the pages of the first 4 worksheets.</p>
  
  <p>Can someone tell me how to achieve what I'm trying to do? The code below is not what I want:</p>
  
  <pre><code>application.ActiveWorkbook.ExportAsFixedFormat(
        Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF,
        path,
        Excel.XlFixedFormatQuality.xlQualityStandard,
        true,
        true,
        1,
        4,
        false,
        Missing.Value);
  </code></pre>