1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| Sub RechInPdf()
Dim AcroApp As Object, AcroAVDoc As Object, AcroPDDoc As Object, AcroTextSelect As Object
Dim PageNum As Object, PageContent As Object, sContent As String, i As Long, j As Long, k As Long, iNumPages As Long
Dim sResultat As String, sNomFichier As String, RchMotAdobePdf As String, Src As String
Set AcroApp = CreateObject("AcroExch.App")
Set AcroAVDoc = CreateObject("AcroExch.AVDoc")
sNomFichier = Range("C" & ActiveCell.Row).Value
If AcroAVDoc.Open(sNomFichier, vbNull) <> True Then Exit Sub
Set AcroPDDoc = AcroAVDoc.GetPDDoc
iNumPages = AcroPDDoc.GetNumPages
For i = 0 To iNumPages - 1
Set PageNum = AcroPDDoc.AcquirePage(i)
Set PageContent = CreateObject("AcroExch.HiliteList")
If PageContent.Add(0, 8000) <> True Then Exit Sub
Set AcroTextSelect = PageNum.CreatePageHilite(PageContent)
For j = 0 To AcroTextSelect.GetNumText - 1
sContent = AcroTextSelect.GetText(j)
Range("K1").Value = Replace(sContent, " ", "")
Select Case Range("K3").Value
Case Is = "="
Range("E" & ActiveCell.Row).Value = Range("E" & ActiveCell.Row).Value & Range("C" & ActiveCell.Row).Value & Chr(10)
Case Is = "<>"
End Select
Next j
Next i
AcroAVDoc.Close False
AcroApp.Exit
Set AcroAVDoc = Nothing
Set AcroApp = Nothing
Call Fermer_Un_Programme("Acrobat.exe")
Range("C" & ActiveCell.Row + 1).Select
End Sub |
Partager