PDF to Excel data copy

vinny2984

Board Regular
Joined
Sep 22, 2008
Messages
202
Does anyone if its possible to write code that will select all in a pdf and copy paste to excel?
I've used the following code to get the PDF file open, which works fine, but thats where it stops for me. If its possible I'd like to be able to continue the code to select all in the PDF doc and paste into excel.
Any ideas?
Thanks

Code:
Shell "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe C:\users\richard\desktop\RDS\Richard Pay form.pdf"
 
Hi Emmily,

Nice VBA Code, Thank you, i was thinking is it possible to select few table from PDF file and only copy thous field in excel..? can i have this VBA Code..?
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi all, I searched the forum rules about posting in a old request, but didn't find any so I'm going to go ahead and post.

I am having an error on the code: StartAdobe = Shell("" & AdobeApp & " " & AdobeFile & "", 1)

I read somebody say it might be the version? But does that mean I wont be able run it? Or needs be changed?

Also is there a way to paste the information in 1 column?? When I paste each space pastes on a different column. But I want it to all paste in 1 column. Can this be done?? Reason to this is, I want add TexttoColumns after the paste, but if it pastes the way its doing it, its already taking up the other columns. Defeats the purpose of texttocolumns.

I appreciate your help,

This is my code:
Code:
Sub StartAdobe()

Dim AdobeApp As String
Dim AdobeFile As String
Dim StartAdobe
 
AdobeApp = "C:\Program Files(x86)\Adobe\Acrobat Reader 2015\Reader\Reader\AcroRd32.exe"
AdobeFile = "C:\users\hongos\desktop\red.pdf"
 
StartAdobe = Shell("" & AdobeApp & " " & AdobeFile & "", 1)

Application.OnTime Now + TimeValue("00:00:05"), "FirstStep"
 
End Sub

Private Sub FirstStep()

SendKeys ("^a")
SendKeys ("^c")
 
Application.OnTime Now + TimeValue("00:00:10"), "SecondStep"
 
End Sub
 
Private Sub SecondStep()
 
AppActivate "Microsoft Excel"
 
Range("A1").Activate
SendKeys ("^v")

End Sub
 
Upvote 0
I have succesfully opened the PDF, but now the Macro ends and it did not paste the information. But the cell changed to A1 as in the last step??? What could I be doing wrong? WHy did it not paste the information?

Also is there a way to paste it on the first column? When I manual pate the information from the PDF, all the items with spaces, get pasted in the following columns. I want it all in one column so I can do a text to column afterwards??

Code:
Sub StartAdobe()
'
' SPA_ITEM_IDENTIFIER Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
Dim AdobeApp As String
Dim AdobeFile As String
Dim StartAdobe
Dim o As Variant
 
o = Shell("C:\Program Files (x86)\Adobe\Acrobat Reader 2015\Reader\AcroRd32.exe C:\Users\mex-hag\Desktop\red.pdf", vbNormalFocus)

Application.OnTime Now + TimeValue("00:00:03"), "FirstStep"
 
End Sub

Private Sub FirstStep()

SendKeys ("^a")
SendKeys ("^c")
 
Application.OnTime Now + TimeValue("00:00:03"), "SecondStep"
 
End Sub
 
Private Sub SecondStep()
 
Dim wkb As Workbook
Dim sht As Worksheet

Set wkb = Workbooks.Open("C:\Users\mex-hag\Documents\DATA BASE ADMINISTRATOR\PROJECTS\SPA ACOP MACRO\SPA ITEM IDENTIFIER.xlsm")
Set sht = wkb.Sheets("Sheet5")

wkb.Activate

 
Range("A1").Activate
SendKeys ("^v")

End Sub
 
Upvote 0
THX guys, fixed it. Didn't stop searching on the net for codes.

Below is the fix for anyone who needs it.

Remember instead of waiting for a response, keep trying to solve it yourself. Search search search and you'll find the answer. :)

Code:
Sub StartAdobe()
'
' SPA_ITEM_IDENTIFIER Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
Dim AdobeApp As String
Dim AdobeFile As String
Dim StartAdobe
Dim o As Variant
 
o = Shell("C:\Program Files (x86)\Adobe\Acrobat Reader 2015\Reader\AcroRd32.exe C:\Users\mex-hag\Desktop\red.pdf", vbNormalFocus)

Application.OnTime Now + TimeValue("00:00:03"), "FirstStep"
 
End Sub

Private Sub FirstStep()

SendKeys ("^a")
SendKeys ("^c")
 
Application.OnTime Now + TimeValue("00:00:03"), "SecondStep"
 
End Sub
 
Private Sub SecondStep()
 
Dim wkb As Workbook
Dim sht As Worksheet

Windows("SPA ITEM IDENTIFIER.xlsm").Activate
Range("a1").Select
ActiveSheet.Paste

 
Range("A1").Activate
SendKeys ("^v")

End Sub
 
Last edited:
Upvote 0
Hello, Vinny. I am using the same code as above and it is not working for me and using the version of Adobe Acrobat 11. Looking forward to hearing back. Thanks!!
 
Upvote 0

Forum statistics

Threads
1,214,559
Messages
6,120,203
Members
448,951
Latest member
jennlynn

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