Pull data from multiple pdf files into separate sheets of a workbook

Zubair57

New Member
Joined
Aug 22, 2014
Messages
12
Hi Gurus,

I have a folder full of pdf files which have similar template. I want to copy the data from each of these files into separate sheet of a workbook.
I have extracted the list of files and file paths in the workbook and tried to run this macro

My predicament is that this macro only copies data from the last pdf in the list.
If I run this macro separately for each pdf, it works fine. Could you help me out?


Sub Shell_Copy_Paste()
Dim o As Variant
Dim wkSheet As Worksheet, WSn As String, i As Integer

For i = 1 To 3
Mypdf = Worksheets("List").Cells(i, 2).Value
o = Shell("C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe " & Mypdf, vbNormalFocus)
WSn = Worksheets("List").Cells(i, 3).Value
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = WSn

Set wkSheet = Worksheets(WSn)


SendKeys "^a" 'Select All
SendKeys "^c" 'Copy

SendKeys "%{F4}" 'Close shell application
wkSheet.Range("A1").Select
SendKeys "^v" 'Paste
o = ""
Set wkSheet = Nothing


Next i
End Sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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