Sub PDF2Excel()
Dim AdobeApp As String
Dim AdobeFile As String
Dim StartAdobe
GetDir = Application.GetOpenFilename("Excel Files (*.pdf), *.pdf")
If GetDir <> "False" Then
MyPath = CurDir & "\"
Else
MsgBox "Directory not selected"
Exit Sub
End If
NextFile = Dir(MyPath & "*.pdf")
While NextFile <> ""
Workbooks.Add
MyXLFile = ActiveWorkbook.Name
AdobeApp = "C:\Program Files\Adobe\Acrobat 9.0\Acrobat\acrobat.exe"
AdobeFile = NextFile
MyFileSaveName = Left(NextFile, Len(NextFile) - 3) & "xlsx"
StartAdobe = Shell("" & AdobeApp & " " & AdobeFile & "", 1)
MyPause = DoEvents
Sleep 1000
SendKeys ("^a")
SendKeys ("^c")
MyPause = DoEvents
Sleep 100
SendKeys ("^q")
Sleep 1000
AppActivate "Microsoft Excel"
DoEvents
ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range("A1")
ParseDataFile
ActiveWorkbook.SaveAs FileName:=MyFileSaveName, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.Close
NextFile = Dir()
Wend
End Sub
Sub ParseDataFile()
Application.ScreenUpdating = False
LastDataRow = ActiveSheet.Range("A65535").End(xlUp).Row
MyRow = 1
Do Until MyRow > LastDataRow
Data2Parse = ActiveSheet.Cells(MyRow, 1).Value
If MyRow = 1 Then
'take some actions for the first header row
ElseIf MyRow = 2 Then
'take some other actions for the next header row
Else
'handle the non-header rows
End If
MyRow = MyRow + 1
Loop
'ActiveSheet.Columns("A").ColumnWidth = 30 'format your columns here
'ActiveSheet.Columns("B").ColumnWidth = 20 'format your columns here
Application.ScreenUpdating = True
End Sub