Pour les personnes qui cherche encore comment imprimer avec PDF Distiller, voici un peu d'aide!
Si vous utilisez une version VB supérieur à vb 5.0:
' Define the postscript and .pdf file names.
Dim LOGFileName As String
Dim PSFileName As String
Dim PDFFileName As String
Dim MySheet As Worksheet
Dim reussite As Boolean
'nom des différents fichiers
LOGFileName = directoryPDF & nomFichier & '.log'
PSFileName = directoryPDF & nomFichier & '.ps'
PDFFileName = directoryPDF & nomFichier & '.pdf'
' test l'existance du fichier de sauvegarde
If repertoireExiste(directoryPDF) = True Then
' Print the Excel range to the postscript file
Set MySheet = ActiveSheet
ActiveWindow.SelectedSheets.PrintOut copies:=1, preview:=False, ActivePrinter:='Acrobat Distiller', printtofile:=True, collate:=True, prtofilename:=PSFileName
'impression avec PdfDistiller
' Convert the postscript file to .pdf
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ''
' suppresion des fichiers temporaires
If Dir(LOGFileName) <> '' Then
Kill LOGFileName 'fichier de log temporaire (supprimer)
End If
If Dir(PSFileName) <> '' Then
Kill PSFileName 'fichier Post Script temporaire (supprimer)
End If
' test de l'impression
If Dir(PDFFileName) = '' Then
MsgBox 'échec le fichier pdf n'a pas été créer!'
End If
' retour du fichier créer
quickPrint = PDFFileName
Else
MsgBox 'Le répertoire de sauvegarde n'existe pas (' & directoryPDF & ')'
quickPrint = ''
End If
End Function
Function repertoireExiste(chemin As String) As Boolean
On Error Resume Next
repertoireExiste = GetAttr(chemin) And vbDirectory
End Function
Remarque:
il faut importer les libraries : Acrobat Distiller et Acrobat Library 7.0