title: Convert excel to pdf with VBScript
body: <p>I want to convert pdf to excel with vbscript but it gives me an error following is my code:</p>
  
  <pre><code>Option Explicit
  Dim objExcel, strExcelPath, objSheet
  
  strExcelPath = "path\file.xlsx"
  
  ' Open specified spreadsheet and select the first worksheet.
  Set objExcel = CreateObject("Excel.Application")
  objExcel.WorkBooks.Open strExcelPath
  Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
  
  ' Modify a cell.
  objSheet.Range("B8").FormulaR1C1  = [sample1]
  objSheet.Range("G11").FormulaR1C1 = [sample2]
  objSheet.Range("G12").FormulaR1C1 = [sample3]
  objSheet.Range("B10").FormulaR1C1 = [sample4]
  objSheet.Range("B11").FormulaR1C1 = [sample5]
  
  ' Save as Excel.
  objExcel.ActiveWorkbook.SaveAs "path\name.xlsx" 
  ' Problem in saving to pdf
  objExcel.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
          Filename:= "path\name.pdf", _
          Quality:= xlQualityStandard, IncludeDocProperties:=True,_
          IgnorePrintAreas:=False, OpenAfterPublish:=False
  
  objExcel.ActiveWorkbook.Close
  objExcel.Application.Quit
  </code></pre>
  
  <p>If you find any imporovement in code also, please tell me.</p>