I found code that I really like and would like to use…however at the end I am getting an empty .ps file
Here is something I really like:
Dim objPDF as PdfDistiller,strRepName as String,strCustomRepName as String, strPath as String, intRetvalue as Integer
strRepName=”Inventory”
strPath=”C:PDFFILEs”
strCustomRepName=”Inventory_Report__Month_May”
Set Application.Printer=Application.Printers(“Adobe PDF”)
set objPDF = New PdfDistiller
intRetValue=objPDF.FileToPDF (strRepName,strPath & strCustomFileName & “.pdf”,””)
******************************************
Sub Generate_PS(strReportName as String) ‘ Generates a post script file
DoCmd.OpenReport strReportName,AcViewPreview
SendKeys “%Fp%l~” & strpath & strReport & “.ps~”,True
DoCmd.Close acReport,strReportName
End Sub
*******************************************
I am however getting an empty Distiller file.
In my adaptation of this code – it looks as follows
strRecruitersNames = !NAME_DISPLAY
ReportName = FileName & ” ” & strRecruitersNames & “_” & FileDateFormat
ReportLocation = “C:My Documents”
DoCmd.OpenReport ReportName:=”Candidate_Report”, View:=acViewPreview, WhereCondition:=”Name_Display = ” & Chr(34) & strRecruitersNames & Chr(34)
SendKeys “%Fp%l~” & strpath & strReport & “.ps~”,True
DoCmd.Close acReport,strReportName
Set Application.Printer=Application.Printers(“Adobe PDF”)
set objPDF = New PdfDistiller
intRetValue=objPDF.FileToPDF (ReportName, ReportLocation & “.pdf”, “”)
********************************************************************************
So my Access Report is open and I am going to the line SendKeys “%Fp%l~” & strpath & strReport & “.ps~”,True
and I see the flash of the directory and print…and no file gets created.
Do you see where I am failing?
Thanks