Acrobat macro décocher Se limiter aux polices système

YannC.

XLDnaute Occasionnel
Bonjour à vous tous,

Voici mon problème : J'ai déjà les macros fonctionnels pour créer un PDF sous excel, mais j'aimerai rajouter dans la macro que la case "Se limiter aux polices système" sois décochée directement. Je vous met mon code ci-dessous seulement pour exemple de ce que j'ai.

Merci beaucoup de votre aide

Sub Tst5()
Dim sNomFichierPS As String
Dim sNomFichierPDF As String
Dim sNomFichierLog As String
Dim PDFDist As PdfDistiller, PrinterDefault As String

PrinterDefault = Application.ActivePrinter
If Imprimante_AdobePDF Then
Application.ActivePrinter = sNomPortReseau
Else
MsgBox "Pas d'imprimante Adobe PDF sur NeXY ", vbOKOnly + vbCritical, "Achtung"
Exit Sub
End If

sNomFichierPS = ThisWorkbook.Path & "\Trimestre 4.ps"
sNomFichierPDF = ThisWorkbook.Path & "\Trimestre 4.pdf"
sNomFichierLog = ThisWorkbook.Path & "\Trimestre 4.log"

Application.ScreenUpdating = False
Sheets(Array("Trimestre 4")).PrintOut copies:=1, Preview:=False, _
ActivePrinter:=sNomPortReseau, PrintToFile:=True, _
PrToFileName:=sNomFichierPS

Set PDFDist = New PdfDistiller
PDFDist.FileToPDF sNomFichierPS, sNomFichierPDF, ""
Set PDFDist = Nothing

Kill sNomFichierPS
Kill sNomFichierLog

Application.ScreenUpdating = True
Application.ActivePrinter = PrinterDefault
UserForm8.Show
End Sub

Private Function Imprimante_AdobePDF() As Boolean
Dim i As Integer
' 11 imprimantes réseau
Imprimante_AdobePDF = False
For i = 0 To 10
If i < 10 Then
sNomPortReseau = "Adobe PDF sur Ne0" & i & ":"
Else
sNomPortReseau = "Adobe PDF sur Ne" & i & ":"
End If
On Error Resume Next
Application.ActivePrinter = sNomPortReseau
If ActivePrinter = sNomPortReseau Then
Imprimante_AdobePDF = True
Exit For
End If
Next i
End Function
 

JNP

XLDnaute Barbatruc
Re : Acrobat macro décocher Se limiter aux polices système

Bonjour Le Linuxien :),
Personnellement, j'ai eu le problème il y a quelques années, et je n'ai pas trouvé de code sur le net. Mais le fait de cocher la case sur chaque poste en passant par la configuration de l'imprimante m'a résolu le problème ;).
Bon courage :cool:
 

YannC.

XLDnaute Occasionnel
Re : Acrobat macro décocher Se limiter aux polices système

Bonjour JNP et merci de ta réponse,

Effectivement c'est une solution, mais comme je change souvent d'ordinateur, je suis fatigué de recommencer à chaque fois cette manipulation.

C'est pour cela que je recherche vraiment une solution en script VBA Excel

Merci encore de ton aide

Yann
 

YannC.

XLDnaute Occasionnel
Re : Acrobat macro décocher Se limiter aux polices système

Salut vous 2 !
Je suis confronté au même problème...
Toujours pas de solution ?

Merci d'avance

Bonjour,

Pour cela, je me sers maintenant de la fonction pdf intégré directement à microsoft office.

Je te met le code :

Sub Tst5()
Dim sNomFichierPDF As String

Application.ScreenUpdating = False

On Error GoTo ErrorHandler
Worksheets("nom de la feuille").Select
With Sheets("nom de la feuille").PageSetup
.Orientation = xlPortrait
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
End With
Sheets("nom de la feuille").PageSetup.PrintArea = "$A$1:$I$130" // zone de la feuille à imprimer
sNomFichierPDF = ThisWorkbook.Path & "\" & "nom du fichier.pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sNomFichierPDF _
, Quality:=xlQualityStandard

Application.ScreenUpdating = True
Worksheets("nom de l'onglet").Select // option : retour à la feuille que tu veux
Exit Sub
ErrorHandler:
MsgBox "Vous avez rencontrer un probleme d'impression. Veillez verifier que votre imprimante PDF soit bien connecté.", vbInformation, "Probleme d'impression"


Resume Next

End Sub


Le code est mis pour ma part dans un module.

Ainsi je n'ai plus le probleme des polices.

Bon courage

Yann CORBISIER (Le Linuxien)
 

Discussions similaires

Réponses
7
Affichages
1 K