Convert PDFs into text?

danhendo888

Board Regular
Joined
Jul 15, 2019
Messages
167
Office Version
  1. 365
Platform
  1. Windows
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]So we receive hundreds of invoices from our customers every day.
The invoices are in pdf format but such that you can select the text and copy and paste etc
Is there a way to convert multiple pdfs of invoices into data so that I can see it Excel or Word?

[/FONT]
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try this macro on one of the PDFs. It copies and pastes the specified PDF to the active sheet. Change the PDF file and Acrobat Reader file path to suit.

The code uses SendKeys which isn't reliable and is quite slow because it calls Wait at various points - adjust the times to suit.

Run the macro from the Excel UI (Developer tab), not the VBA editor.

Code:
Public Sub Copy_and_Paste_From_PDF_File2()

    Dim AdobeApp As String
    Dim PDFfile As String
    Dim StartAdobe
     
    ActiveSheet.Cells.Clear
    
    AdobeApp = "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"   'Acrobat Reader
    
    PDFfile = "C:\path\to\Invoice 123.pdf"
    
    StartAdobe = Shell(Q(AdobeApp) & " " & Q(PDFfile), 1)
    
    'Wait 3 seconds to allow PDF to open
    Application.Wait DateAdd("s", 3, Now)
    
    'Select All and Copy from PDF
    SendKeys "^a^c", True
    
    'Wait 5 seconds to allow Select All and Copy to finish
    Application.Wait DateAdd("s", 5, Now)
    
    'Paste into Excel
    AppActivate Application.Caption
    ActiveSheet.Range("A1").Select
    SendKeys "^v", True
   
End Sub

Private Function Q(text As String) As String
    Q = Chr(34) & text & Chr(34)
End Function
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
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