I have tried the below code to open pdf file in Adobe Acrobat Pro. It opens the file dialogue and allows me to select the pdf file. Once i select the pdf file it gives error ” THERE WAS AN ERROR OPENING THIS DOCUMENT. THE FILE CANNOT BE FOUND.” Any help would be great.
Sub Get_Pdf()
Dim XLName As String, PDFPath As String, READERPath As String
Dim OpenPDF, sh As Worksheet
XLName = ThisWorkbook.Name
Set sh = ThisWorkbook.Sheets(1)
PDFPath = Application.GetOpenFilename(filefilter:="PDF file (*.pdf), *.pdf")
If UCase(PDFPath) = "FALSE" Then Exit Sub
'~~> Below path differs depending Adobe version and installation path
' READERPath = "C:Program FilesAdobeReader 11.0ReaderAcroRd32.exe "
READERPath = "C:Program FilesAdobeAcrobat DCAcrobatAcrobat.exe "
Shell READERPath & PDFPath, vbNormalFocus: DoEvents
Application.Wait Now + TimeValue("00:00:2")
SendKeys "^a", True
Application.Wait Now + TimeValue("00:00:2")
SendKeys "^c"
Application.Wait Now + TimeValue("00:00:2")
Windows(XLName).Activate
sh.Paste sh.Range("A1")
SendKeys "%{F4}", True
End Sub