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.
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.