PDF to Word Converter
VBA

PDF to Word Converter Macro in Excel VBA

In this article we will tell how you can develop your own PDF to Word converter using Excel VBA. You can convert multiple files using this macro. Keep all your PDF files in one folder.

You need to provide the link of PDF and word files folder path on Excel Sheet (Rename is as Settings). Word files folder should be empty. Word files will be saved into this folder after conversion.

Also learn how to Convert Excel to PDF and Word to PDF using VBA macros.

Put the Folder Path on Setting Sheet
Put the Folder Path on Setting Sheet

Below is the VBA Code which you can copy in your module and assign this macro on a button in Settings sheet.

Option Explicit

Sub Word_To_PDF()

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.DisplayStatusBar = True

Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Settings")

Dim pdf_path As String
Dim word_path As String

pdf_path = sh.Range("E4").Value
word_path = sh.Range("E5").Value

Dim fso As New FileSystemObject
Dim fo As Folder
Dim f As File

Set fo = fso.GetFolder(pdf_path)

Dim wa As Object
Dim doc As Object

Set wa = CreateObject("word.application")
wa.Visible = True

Dim file_Count As Integer

For Each f In fo.Files

Application.StatusBar = "Converting - " & file_Count + 1 & "/" & fo.Files.Count
Set doc = wa.Documents.Open(f.Path)
doc.SaveAs2 (word_path & "\" & Replace(f.Name, ".pdf", ".docx"))
doc.Close False
file_Count = file_Count + 1
Next

wa.Quit

MsgBox "All PDF files have been converted in to word", vbInformation
Application.StatusBar = ""

End Sub

 

Click here to download this practice file.

 

Watch the step by step video tutorial:

PK
My Name is PK. I am founder of PK-AnExcelExpert.com. I am a Microsoft Certified Professional. I have more than 10 years of experience in Data Visualization, Excel Automation and dashboard creation. Excel is my passion and I like to do always something innovative in Excel and share it with other people.
https://www.pk-anexcelexpert.com