Ouvrir un document Word et l'exporter en PDF depuis macro VBA Excel

Bonjour,

J'aimerai avoir une macro qui m'exporte un fichier word (sans l'ouvrir) en pdf depuis mon classeur excel. J'ai beau chercher je n'ai pas réussi...

Quelqu'un peut-il m'aider?

Cordialement,

Alexandre

Bonjour,

à tester,

Sub Save_DOC_PDF()
'nécessite la référence à Microsoft Word xx
Dim wApp As Word.Application, wDoc As Document, sDoc As String, sPDF As String

sDoc = "C:\Users\isabelle\Documents\Test1\Aaax.docx"
sPDF = "C:\Users\isabelle\Documents\Test1\Aaax.pdf"

Set wApp = CreateObject("word.application")
wApp.Documents.Open sDoc
wApp.Visible = False
Set wDoc = wApp.ActiveDocument

wDoc.ExportAsFixedFormat OutputFileName:=sPDF, _
        ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
        wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
        Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
        CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
        BitmapMissingFonts:=True, UseISO19005_1:=True

wDoc.Close
Set wDoc = Nothing
Set wApp = Nothing
End Sub

Merci

Rechercher des sujets similaires à "ouvrir document word exporter pdf macro vba"