HomeGrowth
Technical User
I used original code from faq703-2533 and it works great with PDFWriter. I tried to modify three lines to use Acrobat Distiller. see below
Public Sub SaveReportAsPDF(strReportName As String, strPath As String)
Dim strOldDefault As String
strOldDefault = QueryKey("Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device")
'Change the printer name from PDFWriter to Distiller
SetKeyValue "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", "Acrobat PDFWriter", REG_SZ
'SetKeyValue "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", "Acrobat Distiller", REG_SZ
SetKeyValue "Software\Adobe\Acrobat PDFWriter", "PDFFilename", strPath, REG_SZ
'SetKeyValue "Software\Adobe\Acrobat Distiller", "PDFFilename", strPath, REG_SZ
SetKeyValue "Software\Adobe\Acrobat PDFWriter", "bExecViewer", 0, REG_SZ
'SetKeyValue "Software\Adobe\Acrobat Distiller", "bExecViewer", 0, REG_SZ
DoCmd.OpenReport strReportName
SetKeyValue "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", strOldDefault, REG_SZ
End Sub
It doesn't work silently behind the scene, but popping the 'Save As' window. What other areas I need to modify in order to get the Distiller to work instead the PDFWriter. Please share your insight if you have successfully modify this one to work with Acrobat Distiller. Thanks!
Public Sub SaveReportAsPDF(strReportName As String, strPath As String)
Dim strOldDefault As String
strOldDefault = QueryKey("Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device")
'Change the printer name from PDFWriter to Distiller
SetKeyValue "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", "Acrobat PDFWriter", REG_SZ
'SetKeyValue "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", "Acrobat Distiller", REG_SZ
SetKeyValue "Software\Adobe\Acrobat PDFWriter", "PDFFilename", strPath, REG_SZ
'SetKeyValue "Software\Adobe\Acrobat Distiller", "PDFFilename", strPath, REG_SZ
SetKeyValue "Software\Adobe\Acrobat PDFWriter", "bExecViewer", 0, REG_SZ
'SetKeyValue "Software\Adobe\Acrobat Distiller", "bExecViewer", 0, REG_SZ
DoCmd.OpenReport strReportName
SetKeyValue "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", strOldDefault, REG_SZ
End Sub
It doesn't work silently behind the scene, but popping the 'Save As' window. What other areas I need to modify in order to get the Distiller to work instead the PDFWriter. Please share your insight if you have successfully modify this one to work with Acrobat Distiller. Thanks!