PDA

View Full Version : Reading pdf file into excel 2007.



aligahk06
10-17-2009, 10:34 PM
Dear All,

I want to read the pdf file into excel 2007. Can i do this ?
I mean converting pdf contents into excel sheet.

Please assist ?

Rgds,
Aligahk06

mdmackillop
10-18-2009, 01:34 AM
Welcome to VBAX
This will copy data into Column 1. Possibly you can extract usable information from there.


Sub OpenPDF()
ActiveWorkbook.FollowHyperlink "C:\AAA\Test.pdf"
Delay 1 'If required
With Application
.SendKeys ("^a"), True
.SendKeys ("^c"), True
.SendKeys ("%{F4}"), True
End With
ActiveSheet.Paste
End Sub

Sub Delay(tim)
Start = Timer
Do While Timer < Start + tim
DoEvents
Loop
End Sub

Bob Phillips
10-18-2009, 02:17 AM
Have you looked at Able2Extract, http://www.investintech.com/prod_downloadsa2e_pro.htm. Not free, but I am told it is pretty good.

aligahk06
10-18-2009, 03:41 AM
Dear Coders,

I am trying but failed to extract pdf contents to excel sheet.
I am having intermediate level knowledge in VBA So please assist me ?
I want to extract the contents of the attached pdf file.The Contents to be extracted is rightmost section only.

Please assist & us with details. ?

Rgds,
Aligahk06








Welcome to VBAX
This will copy data into Column 1. Possibly you can extract usable information from there.


Sub OpenPDF()
ActiveWorkbook.FollowHyperlink "C:\AAA\Test.pdf"
Delay 1 'If required
With Application
.SendKeys ("^a"), True
.SendKeys ("^c"), True
.SendKeys ("%{F4}"), True
End With
ActiveSheet.Paste
End Sub

Sub Delay(tim)
Start = Timer
Do While Timer < Start + tim
DoEvents
Loop
End Sub

mdmackillop
10-18-2009, 03:51 AM
Your file appears to be protected against copying. I can't see a way around this. I'm doubtful, in any case, if my simple code could handle this type of data.

aligahk06
10-18-2009, 04:19 AM
Your file appears to be protected against copying. I can't see a way around this. I'm doubtful, in any case, if my simple code could handle this type of data.
While running your code the code itself appearing in Col1. Not contents.
Please advise?

mdmackillop
10-18-2009, 05:36 AM
The code is attempting Edit/Select All then Edit/Copy. As this is not available in the PDF when opened manually, it will not work from VBA code.
This appears to be a scanned file, and text values are not available. I don't see a solution to this.