This document contains a VBA macro that extracts text from a selected PDF file and populates it into the first worksheet of an Excel workbook. It utilizes Adobe Reader objects to open the PDF, retrieve text from each page, and write it into cells. The process concludes with a message box confirming successful data extraction.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
3 views
Open PDF File
This document contains a VBA macro that extracts text from a selected PDF file and populates it into the first worksheet of an Excel workbook. It utilizes Adobe Reader objects to open the PDF, retrieve text from each page, and write it into cells. The process concludes with a message box confirming successful data extraction.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
Sub ExtractPDFtoExcel()
Dim pdfApp As Object
Dim pdfDoc As Object Dim pdfText As String Dim i As Integer Dim ws As Worksheet
' Set worksheet
Set ws = ThisWorkbook.Sheets(1)
' Select PDF file
pdfFile = Application.GetOpenFilename("PDF Files (*.pdf), *.pdf", , "Select PDF File") If pdfFile = "False" Then Exit Sub
' Create Adobe Reader Object
Set pdfApp = CreateObject("AcroExch.App") Set pdfDoc = CreateObject("AcroExch.PDDoc")
' Open PDF file
If pdfDoc.Open(pdfFile) Then For i = 0 To pdfDoc.GetNumPages - 1 pdfText = pdfDoc.GetJSObject.getPageNthWordQuads(i) ws.Cells(i + 1, 1).Value = pdfText Next i pdfDoc.Close End If
' Close Adobe Reader
pdfApp.Exit Set pdfDoc = Nothing Set pdfApp = Nothing
MsgBox "PDF data extracted successfully!", vbInformation