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 ?

I am not too sure of how i can create an instance. Samples given are in VB, not in VBS.
I ve seen the example in vba in the API such as:
Dim pdf As PdfDistiller
pdf.FileToPdf "My Test File.ps", "", ""
I tried to adapt this declaration into my VBS such as:
'option explicit
Dim Xlapp 'Excel
Dim wb 'le classeur
Set XlApp = CreateObject("Excel.application")
XlApp.Visible = True
Set Wb = XlApp.Workbooks.Open("C:\tmp\Publisher_Template_test.xls")
Wb.Sheets(1).PrintOut ,,,,"Adobe PDF",True,,"c:\tmp\essai.ps"
wb.close false
Dim dis 'distiller app
Dim ps 'le fichier psscript
Set dis = CreateObject("PdfDistiller.application")
FileToPDF "c:\tmp\essai.ps","c:\tmp\essai.pdf","Print"
XlApp.quit
Set Wb = Nothing
Set XlApp = Nothing
It would be really helpful if you would have an idea how to instanciate an distiller object in vbs
Many thanks for your help.

Similar Messages

  • I am trying to Add In to my excel 2013 a tab on the tool bar  that would allow me to make a PDF from my spread sheet

    I am trying to Add In to my excel 2013 a tab on the tool bar  that would allow me to make a PDF from my spread sheet
    I went to add ins in the excel options ,& it shows the add in however the tab does not appear

    am trying to Add In to my excel 2013 a tab on the tool bar  that would allow me to make a PDF from my spread sheet
    I went to add ins in the excel options ,& it shows the add in however the tab does not appear

  • Problems with black color creating PDF from Excel 2013

    Hi
    I want to create PDF from Excel 2013 using Adobe Acrobat distiller. When I do so I have problem with black which is 300 percent black instead of 100K. Problem is only with drawed lines from Excel's symbol menu (text is fine).
    I use Acrobat 9 Pro and few days ago switched from Office 2000 to 2013.....and problems started.
    Office 2000 and Acrobat 9 Pro worked ok and everything including drawed symbols like lines or squares were 100K black in PDF. Now in the case of Excel 2013 it is not so but when I use export function included in Excel and export file to PDF output is 100K. I am not sure if this kind of export is good for me. I use PDF's as inputs to InDesign. So I would like to have more control when create PDF from excel. But in Excel setup I can choose standard and minimum size and that is all.
    I imported Adobe PDF Settings from computer where these settings worked with Excel 2010 but they do not do same job for me in combination with Excel 2013 (I have 300 black).
    To explain my workflow:
    I am a publisher of crossword magazine and I use Excel to write crosswords. Then I create PDF's and import them into InDesign.   
    Should I use internal export included in Excel 2013? Are these PDF's ok for working in InDesign and finally for print purposes?
    Or If you have any suggestion how to create PDF via Adobe Acrobat distiller setup (which I prefer) please give me advice.
    Thank you in advance
    Juraj

    These are tough issues I suspect and the answer you need is probably trivial (it is finding it). I will make some suggestions, but I have no idea if any will work.
    -  In the printer under the Properties>Layout>Advanced>print quality, I use 300 dpi (default is 1200).
    - Under the printer preferences>settings>edit the settings file, I use again 300 dpi (default is 1200 dpi).
    These may not fix your issue, but migth be worth a try. You could also try using the preflight script to change to gray-scale. It may not make any changes, but again may be worth a try.
    All I am trying to suggest are the things I would be looking at. Maybe they will lead you someplace. Others may be by with better suggestions in time.

  • Acrobat X Pro - create PDF from Excel with no margins...ARGH!

    Hello all,
    Does anyone know if it's possible to create a PDF from a selection of Excel cells without a margin appearing on the PDF file? Even if I set the print margins (print to Adobe PDF) to zero, Acrobat still puts in margins in the PDF. The background of the Excel file is black (as specified by my manager), and he wants black all the way to the edges of the PDF page.
    I have to submit this weekly, and as it's several pages long I don't want to be faffing about with the crop tool each Monday morning (it already takes long enough to source the data). The current solution I have been given is to create a template in Powerpoint (HATE) and link the cells/graphs, but and paste any text boxes, and then convert from Powerpoint to PDF, as no margins are imposed this way.I know cropping would be quicker than this, but surely in this day and age it's easily possible and there's just some simple option I'm just missing?
    Regards,
    George

    I have the same setup with Win 7 and Office 2010 and have created thousands of PDF from Excel sheets, but never noticed this particular issue.  Regardless, rather than fight an issue like this where no specific documentation exists, I usually resort to other options in the interest of not getting bogged down in a maddening search for answers. 
    Go ahead and convert to PDF so that your links are retained, etc.  Open the resulting file in Acrobat, and use the crop tool to remove the blank margins that are at issue, either maintaining proportionality or not, depending on your needs, making sure to set the cropping tool to apply the scheme to all pages.  I'm assuming that all pages are formatted the same, such that this strategy will work.  Then, apply the cropping, and sanitize the file to remove the cropping data.  At this point, your blank margins should be completely gone, and the file can be scaled for printing if that is your objective, but that will obviously introduce some white margins again at the printer.
    The only other option I'm aware of to address this from the PDF side is via a third-party plug-in from Evermap called AutoPagex.  One of its features allows you to scale a document's content to the page margins, either maintaining proportionality or not.  Without proportionality, I was able to scale an Excel sheet with black background to all but a tiny sliver of the top and bottom margins in landscape orientation.  From here, I scaled the content via an additional feature to 100.5%, and all white margins were gone.  That said, it probably just as effective to accomplish this via the crop tool, assuming the page formatting remains consistent.        
    Disclosure:  I have no affiliation of any kind with Evermap, but did address the use of several of their products in my book, "The PDF Litigation Guide."
    Hope that helps!
    Jason Covey
    PDF Litigation Solutions, LLC
    www.pdflitigationguide.com

  • Generate a PDF from Excel with a Digital Signature Field?

    Hello,
    I have an excel workbook that is filled out weekly- I then have to generate a PDF with a digital signature field for a manager to sign (vouching for the data).  I currently have to manually generate the PDF and then manually add a digital signature field.  Is there any way to generate the PDF from excel with a digital signature field that can then be signed?
    Thanks for any help
    -Nathan

    Moved to Acrobat forum.

  • Cannot print pdf from Excel. Saving as log file

    I am trying to print an Excel page to pdf and everytime I get an error.
    I am using Adobe Acrobat 9 and Excel 2010

    You printed to Adobe PDF from excel.
    There was an error which prevented the pdf from being created.
    That log file lists the errors and seeing it's content might enable us to determine why the job failed.
    Open the log file with Notepad or any text editor (Word)
    Copy that text to this forum

  • Page size error when creating PDF from Excel 2013

    Hello,
    I am using Acrobat Pro XI, and am creating a PDF from Excel 2013.  I have updated Acrobat to the latest version (11.0.4).  I am using the Acrobat CreatePDF add-in inside Excel to convert a spreadsheet to PDF.  However, when I create the PDF, the page size doubles from 8.5" x 11" to 17" x 22".  I have checked the print settings inside Excel to insure that the content fits onto an 8.5" x 11" page.  I also checked the Preferences->Advanced Preferences of the Create PDF add-in and confirmed that the default page size is set to 8.5" x 11".  Does anyone know why it is creating the PDF with a 17" x 22" page size?  Also, can the page be resized back down to 8.5" x 11" within Acrobat Pro XI? 

    Hello - this did not happen when I printed the file to the Adobe PDF printer.  It correctly sized the sheet as 8.5" x 11".  Thanks for the suggestion.  Also, it will properly print out to the physical printer. 
    The main problem is when I am combining several PDFs into one document, I have some sheets sized at 8.5" x 11" and some at 17" x 22", so the document looks strange when viewing it online.  I am still not sure why the Create PDF add-in creates a different sized PDF than the Print to PDF function. 

  • Text getting cut off when printing to PDF from Excel

    Hello,
         I've seen a lot related to this subject but nothing that shows a real solution.
         Using Excel 2003-sp3 and Adobe Acrobat v.9 Standard, the right half of the last character in the string gets cut off. It prints from excel fine.
         It's not always the text that is the right-most on the page either. An affected PDF file is attached - note the cut off "S" on the last line (NET ASSETS OF GOVERNMENTAL ACTIVITIES).
         Any assistance is appreciated.
    Thanks,
    Kevin Murphy

    please delete me from your mailing list.  tks.
    Date: Wed, 10 Feb 2010 11:20:28 -0700
    From: [email protected]
    To: [email protected]
    Subject: Text getting cut off when printing to PDF from Excel
    Hello,
         I've seen a lot related to this subject but nothing that shows a real solution.
         Using Excel 2003-sp3 and Adobe Acrobat v.9 Standard, the right half of the last character in the string gets cut off. It prints from excel fine.
         It's not always the text that is the right-most on the page either. An affected PDF file is attached - note the cut off "S" on the last line (NET ASSETS OF GOVERNMENTAL ACTIVITIES).
         Any assistance is appreciated.
    Thanks,
    Kevin Murphy
    >

  • Create double sided PDF from Excel Worksheet

    Hello,
    Under Vista with Excel and Acrobat 7 pro.
    I have to send a PDF file to the printer but they want the job to be double-sided. From Excel, when converting to PDF, I get a one sided document.
    Is there a way to create a double-sided PDF from Excel?
    Thanks,
    L.

    I see what you are talking about now. What needs to be done is to go back to the Excel file and do it there with odd and even page formating. A PDF is simply a version of what would have been printed to paper. Acrobat is not an editor in which the margins can be easily adjusted. If you have only a few pages to do, you can use the object touchup tool to select every thing on a page and move it to the right (Edit>Select All will help and use the arrow keys to move). You might be able to move the whole document to the right, but I would have to play around to do that (don't see a way).
    You may also be able to do the job with JavaScript, but in any case what you are asking is not a simple task that can be done with a trivial margin adjust. There is no such margin definition in a PDF.
    You might find the use of the grid helpful in moving things so that they line up where you want.

  • Hod do I make a pdf from a scanner in Adobe XI?

    I have Adobe XI.  I want to make a pdf from a document on my scanner.  This was simple to do in earler versions. How do I do this in XI?

    What is Adobe XI - Reader or Acrobat?
    With Acrobat you do it exactly the same way as in earlier versions.
    Adobe Reader cannot create PDF documents in any way.

  • How do i print to pdf from excel? I am using Windows 8.1 and Office 365 (new)

    How do i print to pdf from excel? I am using Windows 8.1 and Office 365 (new)

    Please see Huge lag in games on bootcamp as a reference. The linked thread is for a GT750m.
    Since there are no mid-2013 Retina models (as per Apple - Support - Technical Specifications), assuming this is your Mac - MacBook Pro (Retina, 15-inch, Late 2013) - Technical Specifications - the same should work for you.

  • Hello, on Mac, when I make a .pdf from a .doc, Acrobat reverses pagination. How do i stop this and get normal order 1,2, 3 ... ? And how will I know whether any good soul has answered, thanks much.

    Hello, on Mac, when I make a .pdf from a .doc, Acrobat reverses pagination. How do i stop this and get normal order 1,2, 3 ... ? And how will I know whether any good soul has answered, thanks much.

    How are you creating the file, exactly?
    And if you don't manage to solve it you can use this free tool I've developed to reverse the page order in Acrobat with a single click:
    Custom-made Adobe Scripts: Acrobat -- Reverse Page Order (FREE)

  • Photos not showing up when I make PDFs from Excel 2007 files

    I make lists for my newspaper. I am working from home today where I use Excel 2007 and Adobe Acrobat Pro 9. I had to tweak my home Adobe settings to mimic ones I use at work for our newspaper's printer, but other than that, I am doing what I normally do to my files. At work I have Excel 2003 and Adobe 8. I am not sure if it is pro or standard. I use Windows in both locations.
    When I go to make the PDF on my home comp, the photos do not show up on the PDF. They print fine from the Excel file. Does anyone have an idea why this might be happening? Thanks!

    A good general step for strange issues is to renew the iPhoto preference file - quit iPhoto and go to "your user name" ==> library ==> preferences ==> com.apple.iPhoto.plist and trash it - launch iPhoto which creates a fresh new default preference file and reset any personal preferences you have changed and if you have moved the iPhoto library repoint to it. This may help
    This does not affect your photos or any database information (keywords, faces, places, ratings, etc) in any way - they are stored in the iPhoto library - the iPhoto preference file simply controls how iPhoto works - which is why renewing it is a good first step.
    LN

  • Saving as PDF from Excel looks different to Excel version

    Hi
    I have been working in Excel and been saving PDF files for the past year using the inbuilt feature in Excel. I have recently installed Adobe Acrobat so that I could save PDFs directly from Excel instead. When I save exactly the same file from Excel, the adobe acrobat PDF looks different to the excel PDF version.
    I have uploaded an image to show you what I mean.
    http://tinypic.com/view.php?pic=1z1ux6d&s=8
    The image on the left is the correct version, this version was saved using the "Save As PDF" option built into excel. The image on the right is the version saved with the Excel acrobat add-in. You can notice how the font is different on acrobat version, the part where it says "Date" and "Description. You will also notice the black lines above the little card icons do not go right to the end of the line like they should. Each of of them little card icons is a seperate image, does Acroboat have trouble converting these little images or something as they appear fine on the Excel version.
    Is there anything that can be done so converting it to PDF will look closer to how its suppose to look?

    I checked the properties of each file. The Excel PDF version has more fonts listed in the properties section compared to the PDF maker one. I can select the "Date" and "description" and copy and paste it as text but now it appears the text is fine, its showing correctly now even though I havent changed anything.
    The icon problem is still there though.
    I have also attached another image of a close up of the little card icons:
    http://tinypic.com/view.php?pic=nqac9j&s=8
    The version on the right is correct, created within the built in PDF feature in Excel. The version on the left, created with the Excel pdf maker addin.

  • I can no longer create a PDF from Excel?

    I have always been able to create a PDF straight from Office, specifically Excel. I downloaded the Adobe XI trial last week, and now I can no longer create a PDF. It says it can't file Adobe PDF Maker?

    I'm having the same issue.  I just downloaded new Adobe Pro XI (old version was IT dept corrupted) and got error that Adobe could not locate resource files.  I could in the past open and create pdf forms from excel, but not now

Maybe you are looking for