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
| Option Explicit
Sub Tst()
Dim Fichier As Variant
Dim sMot As String
sMot = "Mot recherché"
ChDir ThisWorkbook.Path
Fichier = Application.GetOpenFilename("Fichier PDF (*.pdf), *.pdf")
If Fichier <> False Then AcrobatFindTexte Fichier, sMot
End Sub
Private Sub AcrobatFindTexte(ByVal sFichier As String, ByVal sRch As String)
Dim oApp As Object
Dim oAvDoc As Object
Dim TextTrouvé As Integer
Set oApp = CreateObject("AcroExch.App")
oApp.Hide
Set oAvDoc = CreateObject("AcroExch.AVDoc")
If oAvDoc.Open(sFichier, "") Then
' Parametres FindText
' StringToSearchFor ,
' caseSensitive (1 Or 0),
' WholeWords(1 Or 0),
' ResetSearchToBeginOfDocument (1 Or 0)
' Renvoie -1 si trouvé, 0 autrement
TextTrouvé = oAvDoc.FindText(sRch, True, False, True)
End If
oApp.Show
oAvDoc.BringToFront
Set oAvDoc = Nothing
Set oApp = Nothing
End Sub |
Partager