Impression excel en pdf avec macro VBA

Bonjour,
Je cherche si quelqu'un aurait une solution à mon problème. J'ai crée un macro qui imprime mon fichier excel. J'aimerais si c'est possible en crée une identique mais qui "imprime" en pdf.
voici ma macro :

Public Sub Imprime()

ActiveSheet.Range("A1:AH126").PrintOut

If Cells(4, 49) <> 0 Then
ActiveSheet.Range("A127:AH189").PrintOut
End If
If Cells(5, 49) <> 0 Then
ActiveSheet.Range("A190:AH253").PrintOut
End If
If Cells(6, 49) <> 0 Then
ActiveSheet.Range("A254: AH316 ").PrintOut
End If
If Cells(7, 49) <> 0 Then
ActiveSheet.Range("A317: AH380 ").PrintOut
End If
If Cells(8, 49) <> 0 Then
ActiveSheet.Range("A381: AH443 ").PrintOut
End If

End Sub

Si quelqu'un à la réponse à ma question je le remercie déjà à l'avance

Bonne journée le forum

5 réponses

  1. Bonjour, alors en regroupant toutes les informations que j'ai pu récolter j'ai réussi à améliorer ma première macro en choisissant l'imprimante et donc je peu sélectionner pdfCreator :
    Public Sub Imprime()
    Application.Dialogs(xlDialogPrinterSetup).Show
    ActiveSheet.Range("A1:AH126").PrintOut

    If Cells(4, 49) <> 0 Then
    ActiveSheet.Range("A127:AH189").PrintOut
    End If
    If Cells(5, 49) <> 0 Then
    ActiveSheet.Range("A190:AH253").PrintOut
    End If
    If Cells(6, 49) <> 0 Then
    ActiveSheet.Range("A254: AH316 ").PrintOut
    End If
    If Cells(7, 49) <> 0 Then
    ActiveSheet.Range("A317: AH380 ").PrintOut
    End If
    If Cells(8, 49) <> 0 Then
    ActiveSheet.Range("A381: AH443 ").PrintOut
    End If

    End Sub

    Merci à tous, bonne journée le forum
    0