Convert a bulk of PDFs into different text files (same names)

Oxirrinko

New Member
Joined
Nov 29, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hello, can anyone help to remake following VBA to repeat the process (open a new PDF file, copy, paste into a new text file)
as many PDF files contains a folder?

Thanks in advance!



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
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,223,884
Messages
6,175,173
Members
452,615
Latest member
bogeys2birdies

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