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
| Private Function AcrobatFindText(ByVal sFichier As String, ByVal sRch As String) As Integer
Dim oApp As Object
Dim oAvDoc As Object
Dim oAvPDPage As Object
Dim iTrouvé As Integer
Set oApp = CreateObject("AcroExch.App")
oApp.Hide
Set oAvDoc = CreateObject("AcroExch.AVDoc")
If oAvDoc.Open(sFichier, "") Then
If Len(sRch) > 0 Then
' Parametres FindText
' StringToSearchFor ,
' caseSensitive (1 Or 0),
' WholeWords(1 Or 0),
' ResetSearchToBeginOfDocument (1 Or 0)
' Rencoie -1 si Trouvé, 0 autrement
iTrouvé = oAvDoc.FindText(sRch, True, True, False)
Else
oAvDoc.Close (1)
Set oAvDoc = Nothing
Set oApp = Nothing
MsgBox "Feuil non trouvé : " & sRch
Exit Function
End If
End If
oApp.Show
oAvDoc.BringToFront
Set oAvPDPage = oAvDoc.GetAvPageView.GetPage
AcrobatFindText = oAvPDPage.getnumber
MsgBox AcrobatFindText
Set oAvPDPage = Nothing
Set oAvDoc = Nothing
Set oApp = Nothing |
Partager