Skip to content

Instantly share code, notes, and snippets.

@jakelosh
Created July 5, 2013 17:02
Show Gist options
  • Save jakelosh/5935865 to your computer and use it in GitHub Desktop.
Save jakelosh/5935865 to your computer and use it in GitHub Desktop.
I recently changed groups at work. In my new unit we process a lot of trades based off of paper trade tickets! In 2013! I was only in the group a day before I was on a mission to find a way to eliminate the paper. I was able to find the starting point for the below code from here: https://groups.google.com/forum/#!msg/excelvbamacros/hPZsy2QyFGM/…
Sub PdfToExcelSendKey()
Dim task
' open the file
' change the path of adobe program as per your desktop
task = Shell("C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe " & "C:\Documents and Settings\e531210\Desktop\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("Book2.xlsm").Activate
Range("b2").Select
ActiveSheet.Paste
' Activate notepad
AppActivate task
' send key to close pdf file
SendKeys "^q"
MsgBox "done"
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment