HI I have been reading so much about this and tried so many codes, but its like its not working always come up with an error. I need convert a pdf file to excel sheet with a macro. So i hope some have a solution would be really nice if it can be uploaded in a file here. I have attached a test pdf file. My Path for the file are.
C:\Users\IBM_ADMIN\Desktop\Test.pdf
My path to adobe reader is
C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe
I have really tried so many macroes uploaded but none are working. So if some have a solution with my test pdf and my version of adobe, it will really be great.-
Below you can see some of the codes i have tried but not working. The first open the pdf file but it paste the macro code into the excel sheet.
So none of them are working.
Please have a look and maybe upload a sheet which are working. Would actually be very good with a openfile dialog for the pdf file. But have a look please.
Thanks in advance
Abjac
My Not working codes.
Public Sub PDFCopy()
'Filepath for your Adobe reader
MyPath = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"
'Filepath for your PDF to open
MyFile = "C:\Users\IBM_ADMIN\Desktop\Test.pdf"
Shell MyPath & " " & MyFile, vbNormalFocus
SendKeys ("^a")
SendKeys ("^c")
SendKeys "%{F4}"
Windows("convertadobe.xls").Activate
Worksheets("Sheet1").Activate
ActiveSheet.Range("A2").Select
SendKeys ("^v")
End Sub
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 Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.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("convertadobe.xls").Activate
sh.Paste sh.Range("A1")
SendKeys "%{F4}", True
End Sub
Bookmarks