12 Replies Latest reply on Jun 18, 2008 4:49 AM by (lorifan)

    VBScript to make a pdf from excel

      Hello<br /><br />I would like to make a pdf from my excel workbook.<br /><br />Here is my code:<br /><br />' VB Script Document<br />option explicit<br />Dim Xlapp 'Excel<br /> Dim wb 'le classeur<br /> Set XlApp = CreateObject("Excel.application")<br /> XlApp.Visible = True<br /> Set Wb = XlApp.Workbooks.Open("C:\tmp\MonClasseur.xls")<br /> Wb.Sheets(1).PrintOut ,,,,"Adobe PDF",True,,"c:\tmp\essai.pdf"<br /> wb.close false <br /> XlApp.quit <br /> Set Wb = Nothing<br /> Set XlApp = Nothing<br /><br />It does create a pdf file but when opening it, I get the following error message:<br /><br />"Acrobat could not open <File Name> because it is either not a supported file type or because the file has been corrupted (for example, it was sent as an email attachment and wasn't correctly decoded)."<br /><br />I use Adobe Acrobat 7.1.0<br /><br />Any idea to solve my issue ?