Open many PDFs in Browser

The below code will show you how to open many Adobe PDF files in an Internet Explorer Browser window. You can combine this with my PDF text grabber video to automate data grabbing from hundreds of PDFs: https://vbatutorialcode.com/adobe-pdf-text-grabber-excel/

Code (Replace C:\Users\18622\OneDrive\Desktop\PDFfolder\ with your folder filepath):

Public Sub PDFOpenMacro()



Dim objIE As Object
  
  
Dim myfile As String
Dim nextrow As Integer

nextrow = 1
With Worksheets("Sheet1").Range("A1")
myfile = Dir("C:\Users\18622\OneDrive\Desktop\PDFfolder\*.*", vbNormal)
.Value = myfile
Do While myfile <> ""
myfile = Dir
.Offset(nextrow, 0).Value = myfile
nextrow = nextrow + 1
Loop
End With

erow = Range("A" & Rows.Count).End(xlUp).Row

Dim counter As Double
counter = 1
Dim fileholder As String


Do Until counter > erow
Set objIE = CreateObject("InternetExplorer.Application")
'The path to the file, replaces spaces with the encoding "%20"
fileholder = Range("A" & counter).Value



urlpath = "C:\Users\18622\OneDrive\Desktop\PDFfolder\" & fileholder
  With objIE
   .Top = 0
    .Left = 0
.height = 1000
.width = 1000
    .Navigate urlpath

  End With
  

 'Call Shell("TaskKill /F /PID " & CStr(objIE), vbHide)
 'or
 'objIE.Quit
 Set objIE = Nothing
  
counter = counter + 1

Loop


End Sub


Comments are closed.