Advertisement
Advertisement
| 07.21.2008 at 06:07AM PDT, ID: 23581628 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: |
Sub Print_PDF_Rpt()
Dim PSFileName As String
Dim PDFFileName As String
Dim MySheet As Worksheet
Dim myPDF As PdfDistiller
Dim I As Integer
'Create PDF reports
Set myPDF = Nothing
'converts that to a PDF file.
PSFileName = "C:\temp.ps"
'Determine which column to get the report file name from
If ActiveSheet.Name = "Trend for Print" Or ActiveSheet.Name = "TN Graphs" Then
PDFFileName = PrintList.range("G" & x) & ".pdf"
ElseIf ActiveSheet.Name = "NIR Current" Or ActiveSheet.Name = "NIR LPO" Then
PDFFileName = PrintList.range("I" & x) & ".pdf"
ElseIf ActiveSheet.Name = "bounce safe" Then
If range("Typerun") = "Standard" Then
PDFFileName = range("BncSfPath") & ".pdf" 'Standard run
Else
PDFFileName = range("BncSfPathAH") & ".pdf" 'Ad Hoc run
End If
ElseIf ActiveSheet.Name = "NSF" Then
If range("Typerun") = "Standard" Then 'x
PDFFileName = range("NSFPath") & ".pdf" 'Standard run
Else
PDFFileName = range("NSFPathAH") & ".pdf" 'Ad Hoc run
End If
End If
'The way the PDFdistiller works, it prints first to a temp file...
If ActiveSheet.Name = "TN Graphs" Then
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True,
ActiveChart.PrintOut Copies:=1, Collate:=True, _
Preview:=False, PrintToFile:=True, _
ActivePrinter:="Acrobat Distiller", _
prtofilename:=PSFileName
Else
range(ActiveSheet.PageSetup.PrintArea).PrintOut Copies:=1, _
Preview:=False, PrintToFile:=True, Collate:=True, _
ActivePrinter:="Acrobat Distiller", _
prtofilename:=PSFileName
End If
Set myPDF = New PdfDistiller
'... then converts the temp file to a PDF file
myPDF.FileToPDF PSFileName, PDFFileName, ""
Kill "c:\temp.ps" 'Deletes the temp file
End Sub
|