• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Adjust and convert conversion code from Pdf file to Excel file

Hany ali

Active Member
hello every body,i want to help me to set this Code to work good
it's code for Convert Pdf File To Excel File
Private Sub CommandButton1_Click()
 'Declare Variable(s)
Dim appAA As Acrobat.CAcroApp, docPDF As Acrobat.CAcroPDDoc
Dim strFileName As String, intNOP As Integer, arrI As Variant
Dim intC As Integer, intR As Integer, intBeg As Integer, intEnd As Integer

'Initialize Variables
Set appAA = CreateObject("AcroExch.App"): Set docPDF = CreateObject("AcroExch.PDDoc")

'Set PDF FileName
strFileName = ThisWorkbook.Path & "\" & "C:\Users\hany.ali\Desktop\PDF-to-Excel-Converter\EXcel.pdf"
'Read PDF File
docPDF.Open (strFileName)

'Extract Number of Pages From PDF File
intNOP = docPDF.GetNumPages

'Select First Data Cell

'Open PDF File
ActiveWorkbook.FollowHyperlink strFileName, , True

'Loop Through All PDF File Pages
For intC = 1 To intNOP
'Go To Page Number
SendKeys ("+^n" & intC & "{ENTER}")

'Select All Data In The PDF File's Active Page
SendKeys ("^a"), True

'Right-Click Mouse
SendKeys ("+{F10}"), True

'Copy Data As Table
SendKeys ("c"), True

'Minimize Adobe Window
SendKeys ("%n"), True

'Paste Data In This Workbook's Worksheet

'Select Next Paste Cell
Range("A" & Range("A1").SpecialCells(xlLastCell).Row + 2).Select

'Maximize Adobe Window
SendKeys ("%x")
Next intC

'Close Adobe File and Window
SendKeys ("^w"), True

'Empty Object Variables
Set appAA = Nothing: Set docPDF = Nothing

'Select First Cell
End Sub
and Pdf File in this Web