I need a piece of vba code to print my form to a pdf document? Microsoft Excel; 7 Comments. Terms of Service apply. I'm constantly posting new free stuff! The VBA code from Kajkrow works well. I'm trying to create a macro that will print the active sheet to PDF, and automatically save it using the contents of cell B3. i know that this issue occurs when youy saveas pdf. All Rights Reserved. I chose my own response as the solution so that I could officially close the question. I do not believe there is a solution. But if the Excel sheet is formatted you might not want to Sign up here to receive notices. The error occurs on the following line: (Get your first solution completely free - no credit card required). https://www.experts-exchange.com/questions/26834183/Printing-PDF-from-Internet-Explorer-using-VBA.html, https://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_20195891.html. This function will save the ActiveSheet as a PDF and (optionally) attach the PDF to an email (assuming you have Outlook installed): Easily access all of the code examples found on our site. Joined Feb 2, 2007 Messages 253. Select Printer Properties. This is my code: Code: Sub SavePDF() ' ' SavePDF Macro ' Macro recorded … Please check your email. My problem is printing through Excel VBA. I would like it to open the document but not print it... my form name is "myformtopdf" Also, the file name should be based on these two other fields within my database...can that be done? This simple procedure will print the ActiveSheet to a PDF. When a command button titled "Print" is clicked, I would like VBA to open a certain Excel workbook based on the combobox inputs, then select the "PDFLite" printer, print a certain spreadsheet based on combobox inputs, and then I can automate the Save location also based on combobox inputs. Thanks for subscribing! Contact me to learn more. Jan 7, 2010 #1 Hi friends! do that. Right Click on 'Microsoft Print to PDF' printer. We help IT Professionals succeed at work. But I could be wrong since I haven't got the code to even execute yet. This simple procedure will print the ActiveSheet to a PDF. Privacy Policy and 8+ characters (letters, numbers, and a symbol). 1 Solution. I'm not sure if that will work if the object is an Excel worksheet. My problem is printing through Excel VBA. Comboboxes: cboCust 'Customer Name An alternative might be to link to the Excel sheet and then send that. .xlam add-in. *This site is protected by reCAPTCHA and the Google Something went wrong. Windows 10 doesn't support "Generic Postscript Printer" but has embedded "Microsoft Print to Pdf" printer. When IE starts it defaults to the default printer. Sub SimplePrintToPDF() ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="demo.pdf", Quality:=xlQualityStandard, _ IncludeDocProperties:=False, IgnorePrintAreas:=False, OpenAfterPublish:=True End Sub . VBA to print sheet to PDF and save using name in cell. Thread starter tkroper; Start date Jan 7, 2010; tkroper Active Member. DOCmd.OutputTo will send an Access object to a PDF file. "At Automate Excel we offer a range of free resources, software, training, and consulting to help you Excel at Excel. Thanks for your feedback, it helps us improve the site. that will print the ActiveSheet to a PDF: The function returns TRUE or FALSE if the print to PDF was successful or not. Print to PDF. I made a modification that allows me to create the .pdf using the free software, PDFLite, but now the file won't open with Adobe.