Converting a PDF file to a Word doc is very common tasks I see in work places and freelance sites. And in this Word VBA tutorial, I will be showing you how we can create a Word Macro using VBA to perform a mass PDF files to Word docs conversion task.

Buy Me a Coffee? Your support is much appreciated!

PayPal Me:
Venmo: @Jie-Jenn

Source Code:

Sub Main()
    Dim Source_Folder_Path As String, Target_Folder_Path As String
    Dim File_Names As String
    Dim doc As Document
    '// Step 1. Assign Folder Paths
    Source_Folder_Path = "<Source Folder Path>"
    Target_Folder_Path = "<Target Folder Path>"
    If Right(Source_Folder_Path, 1) <> "\" Then
        Source_Folder_Path = Source_Folder_Path & "\"
    End If
    If Right(Target_Folder_Path, 1) <> "\" Then
        Target_Folder_Path = Target_Folder_Path & "\"
    End If
    '// Step 2. Grad all the PDF files
    File_Names = Dir(Source_Folder_Path & "*.pdf")
    Application.DisplayAlerts = wdAlertsNone
    Do While File_Names <> ""
        Set doc = Documents.Open(Source_Folder_Path & File_Names, False)
        '// Convert the PDF file to Word Doc
        doc.SaveAs2 Target_Folder_Path & Replace(File_Names, ".pdf", ".docx"), wdFormatDocumentDefault
        doc.Close False
        Set doc = Nothing
        File_Names = Dir()
    Application.DisplayAlerts = wdAlertsAll
    MsgBox "Conversion is finished"
End Sub