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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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