Home>Blogs>VBA>PDF to Word Converter Macro in Excel VBA
PDF to Word Converter

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


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:

Meet PK, the founder of PK-AnExcelExpert.com! With over 15 years of experience in Data Visualization, Excel Automation, and dashboard creation. PK is a Microsoft Certified Professional who has a passion for all things in Excel. PK loves to explore new and innovative ways to use Excel and is always eager to share his knowledge with others. With an eye for detail and a commitment to excellence, PK has become a go-to expert in the world of Excel. Whether you're looking to create stunning visualizations or streamline your workflow with automation, PK has the skills and expertise to help you succeed. Join the many satisfied clients who have benefited from PK's services and see how he can take your Excel skills to the next level!