• 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

    Hui...

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

Macro for getting value from pdf to excel

Brijesh

Member
Dear All

I want to copy some value from a pdf file and to paste it in a particular excel file. I am using following code but not able to do the desired.

Sub Shell_Copy_Paste()

Dim o As Variant
Dim wkSheet As Worksheet

Set wkSheet = ActiveSheet

o = Shell("C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Acrobat.exe C:\Users\Victor Lan\Documents\sample.pdf", vbNormalFocus)

Application.Wait (Now + TimeSerial(0, 0, 2)) 'Wait for Acrobat to load

SendKeys "^a" 'Select All
SendKeys "^c" 'Copy
SendKeys "%{F4}" 'Close shell application

wkSheet.Range("B5").Select
SendKeys "^v" 'Paste

End Sub


I have got the above code from a website. The macro runs but the problem is that it does not paste anything in excel.

Thanks in advance
Brijesh
 
Thanks Narayan

I went to the link but i found nothing useful for my purpose. In between I tried the above code for copying value from word to excel. Again it was giving the same problem. The macro ran, the word file opened, value in word file selected (and i think copied also), after that word file closed but ultimately no value pasted in excel.
After that i replace the last line of above coding

SendKeys "^v" 'Paste

With this one

ActiveSheet.Paste

And the macro gave the desired output

Can you please tell why the last line of earlier coding was not working?

Brijesh
 
Back
Top