VBA Pdf Excel with ShellExecute not pasting to Excel -


i've been trying vba in excel copy pdf excel.

i tried different things, list below in case wants try fortune:

  • i tried code here, indicate enable reference, seems work if have acrobat pro installed.

  • use shell , shellexecute: tried code here, kept getting error when pdf opening saying not find file. tried using shellexecute following commentshere , code here, couldn't manage make work.

finally, using shellexecute found code here allows me open pdf file without error

private declare function shellexecute lib "shell32.dll" alias "shellexecutea" _ (byval hwnd long, byval lpoperation string, byval lpfile string, _ byval lpparameters string, byval lpdirectory string, byval nshowcmd long) long  sub evn()     filename = "c:\test.pdf"      shellexecute 0, "open", filename, "", "", vbnormalnofocus end sub 

the problem how copy contents once i've opened file. tried adding following after file open:

' select using ctrl sendkeys "^a", true ' wait 2 secs application.wait + timevalue("00:00:2") ' copy using ctrl c sendkeys "^c" ' wait 2 secs application.wait + timevalue("00:00:2") ' activate wokbook windows("pdftoexcel.xlsb").activate range("a2").select activesheet.paste 

but error message when gets range("a2").select saying run-time error 1004: application-defined or object-defined error.

is there way succesfully copy contents of pdf file once open paste in excel?


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -