title: VBscript to save excel sheet as pdf
body: <p>I'm working on <code>HTML5</code> project.
  In this project I want to create a PDF of an Excel sheet by clicking on "Make PDF" button. But my below code is not working.
  Is there any way to create a PDF of an Excel sheet from HTML without opening an Excel file?</p>
  
  <pre class="lang-vbs prettyprint-override"><code>&lt;html&gt;&lt;head&gt;
  &lt;script language="vbscript" type="text/vbscript"&gt;
  Sub SaveExcelAsPDF ()
      'Save Excel file as a PDF
  
      'Initialise
      Dim objExcel, objWorkbook
      Set objExcel = CreateObject("Excel.Application")
  
      'Open the file
      Set objWorkbook = objExcel.Workbooks.Open ("file:\\\D:\\Book1.xlsx")
      objExcel.Visible = True  
      ObjWorkbook.Windows (1).Visible = True  
      Set XlSheet =objWorkbook.Sheets (3)  
      XlSheet.Activate  
  
      'Save the PDF
      objWorkbook.ExportAsFixedFormat EXCEL_PDF, PathOfPDF(p_strFilePath), EXCEL_QualityStandard, TRUE, FALSE, , , FALSE
  
  
      'Close the file and exit the application
      objWorkbook.Close FALSE
      objExcel.Quit
  End Sub
  &lt;/script&gt;&lt;/head&gt;
  &lt;body&gt;
    &lt;center&gt;
      &lt;br&gt;
      &lt;tr&gt;
        &lt;td&gt;
          &lt;input type="submit" onclick="SaveExcelAsPDF()" value="Make PDF" /&gt;
          &lt;br&gt; &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/center&gt;
  &lt;/form&gt;&lt;/body&gt;&lt;/html&gt;
  </code></pre>