If you want to copy the data from pdf file to Excel.
Sub method1_using_sendkey()
Dim task
' open the file
' change the path of adobe program as per your desktop
task = Shell("C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe " & "C:\Documents and Settings\user\Desktop\Pdf to excel test.pdf", vbNormalFocus)
' wait 2 secs
Application.Wait Now + TimeValue("00:00:2")
'send key to select all text
SendKeys "^a", True
' wait 2 secs
Application.Wait Now + TimeValue("00:00:2")
' send key to copy
SendKeys "^c"
' wait 2 secs
Application.Wait Now + TimeValue("00:00:2")
' activate this workook and paste the data
Windows("Pdf to Excel.xlsm").Activate
Range("a2").Select
ActiveSheet.Paste
' Activate notepad
AppActivate task
' send key to close pdf file
SendKeys "^q"
MsgBox "done"
End Sub
Download File: https://www.box.com/s/ 920f1404c24fc15e1d8e
Check this method too
ReplyDeletehttps://groups.google.com/forum/?fromgroups#!topic/excelvbamacros/hPZsy2QyFGM