automate copying a merge field of PDF into excel VERY VERY URGENT

excel.syed

New member
Joined
Jan 12, 2012
Messages
1
Reaction score
0
Points
0
Location
A, A
This code i have find out to read all pages in pdf
files and copy it in excel
but i want to pick a sentence... " the contract
no.3235 " in pdf files
the contract no. changes.. Can we do untill loops
till the last page and paste the result in excel column....one below the other
this can be great help


Code :

Dim AdobeApp As String
Dim AdobeFile As
String

Dim StartAdobe
Dim strPath As
String

Dim strFile As String
Sub
LoopThruDirectory()



strPath = "C:\_ImportTest\"
strFile =
Dir(strPath)


Do While strFile <>
“”

Sheets.Add
After:=Sheets(Sheets.Count)

StartAdobeApp
strFile = Dir ' Get next
entry.

Loop

End Sub
Sub StartAdobeApp()

AdobeApp = "C:\Program Files
(x86)\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe"

AdobeFile = strPath &
strFile


StartAdobe = Shell("" & AdobeApp & " " &
AdobeFile & "", 1)


Application.OnTime Now + TimeValue("00:00:05"),
"FirstStep"


End Sub
Private Sub FirstStep()
SendKeys ("^a")

' this the place i want a loop to find into the pages till last.
copy only the selected text "contract no.34234" the number part keep changing..
and move on to the next page ....the looping till last page of the pdf...and
paste the entire copied strings...into excel one string in one cell..


SendKeys ("^c")
Application.OnTime Now +
TimeValue("00:00:10"), "SecondStep"

Call
SecondStep

End Sub

Private Sub SecondStep()
SendKeys
("%fx")

AppActivate "Microsoft
Excel"

ThisWorkbook.Activate
Range("A1").Activate
SendKeys
("^v")

End Sub
 
Back
Top