Convert PDF to Excel vía Word

juanbolas

New Member
Joined
Dec 3, 2014
Messages
40
Office Version
  1. 365
Platform
  1. Windows
Hello,

I found this piece of code on the web and it's pretty descent. However it's just converting the first page of a series of three page documents.

Any ideas?

Thanks in advance!

VBA Code:
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
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hello,

I found this piece of code on the web and it's pretty descent. However it's just converting the first page of a series of three page documents.

Any ideas?

Thanks in advance!

VBA Code:
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
Free Online Converter - Spy Tools
Can anyone help me with a free and good working Converter from pdf to excel. works fine with 32 bit and 64 bit.
 
Upvote 0
Use Power Query. Called Get and Transform and is on the Data Tab.
Get and Transform-->Get Data-->From File-->From PDF
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top