Just wanted to say thanks for this piece of code. I have a modified version of this working with Access 10 on Windows 7, PDFCreator 1.2.2. It has really saved our bacon workwise this year. Thanks.
You can view the page at http://www.excelguru.ca/forums/conte...-To-A-PDF-File
Ken Puls, FCPA, FCMA, MS MVP
Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book Master Your Data for Excel and Power BI, or our new Power Query Recipe cards!
Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter
If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.
Just wanted to say thanks for this piece of code. I have a modified version of this working with Access 10 on Windows 7, PDFCreator 1.2.2. It has really saved our bacon workwise this year. Thanks.
Hi,Have tried running the exact code, but keep getting "fail to initialize error". running pdfcreator 1.6.2 and windows 7 access 2010. Never had problems in the past, but now not getting it to work. Any suggestions are appreciated.Thanks Eric
. I am progressing slightly. Latest is that the access report opens, yet it stays in the Do Until pdfjob.cCountOfPrintjobs = 1
DoEvents
Loop endlessly. Any suggestions? it does not seem to add the printerjob to the printingqueu. What am I doing wrong? Suggestions are much appreciated. Thanks for your time, Eric
Hello all,
I've modified the code because I need as output not a pdf file but a png file. It works but the image is in greyscale, how should I modify the code in order to get colors?
Many thanks.
Code:SetMyPdfToJPEG() Dim pdfjob As PDFCreator.clsPDFCreator Dim sPDFName As String Dim sPDFPath As String Dim sPrinterName As String Dim sReportName As String Dim lPrinters As Long Dim lPrinterCurrent As Long Dim lPrinterPDF As Long Dim prtDefault As Printer Dim sReportName1 As String '/// Change the report and output file name here! /// sReportName = "ST" 'scheda tecnica sReportName1 = "ST_1" 'scheda tecnica1 sPDFName = sReportName & Format(Date, "yyyymmdd") & ".png" sPDFPath = Environ$("Userprofile") & "\Desktop\" '& sPDFName & "_copy" Set pdfjob = New PDFCreator.clsPDFCreator With pdfjob If .cStart("/NoProcessingAtStartup") = False Then MsgBox "Can't initialize PDFCreator.", vbCritical + _ vbOKOnly, "PrtPDFCreator" Exit Sub End If .cOption("UseAutosave") = 1 .cOption("UseAutosaveDirectory") = 1 .cOption("AutosaveDirectory") = sPDFPath .cOption("AutosaveFilename") = sPDFName .cOption("AutosaveFormat") = 1 ' 0 = PDF 1=PNG , 2= JPEG .cClearCache End With DoCmd.PrintOut acSelection, , , acHigh, 1, True 'waiting for printing completion Do Until pdfjob.cCountOfPrintjobs = 1 DoEvents Loop pdfjob.cPrinterStop = False 'waiting routine completion Do Until pdfjob.cCountOfPrintjobs = 0 DoEvents Loop pdfjob.cClose Set pdfjob = Nothing
Bookmarks