Te anexo la macro. Funciona de la siguiente manera:
En la hoja2 en la celda A2 tienes que poner el texto a buscar.
Tienes que tener una hoja llamada "hoja3"
Lo que hace la macro es abrir el PDF, si el PDF tiene texto, es decir, no es una imagen, entonces se selecciona todo el texto y se copia a la hoja3, una vez en la hoja3 se hace el conteo.
El resultado te lo pone en la hoja2 en la celda B2.
Sub ContarDatosDeUnPdf()
'Por.Dante Amor
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set h2 = Sheets("Hoja2") 'contador
texto = h2.Range("A2")
'
Set h3 = Sheets("Hoja3") 'temporal
h3.Cells.Clear
'
ruta = "C:\Documents and Settings\DAMOR\Mis documentos\docs\Soporte expertos\"
ActiveWorkbook.FollowHyperlink ruta & "\" & "Libro1.pdf"
Application.Wait Now + TimeValue("00:00:01")
DoEvents
SendKeys "{TAB}", True
DoEvents
SendKeys "{ENTER}", True
DoEvents
DoEvents
SendKeys "^a", True
DoEvents
SendKeys "^c", True
Application.Wait Now + TimeValue("00:00:05")
SendKeys "%{F4}", True
'
ThisWorkbook.Activate
h3.Range("A1").PasteSpecial
Set r = h3.Cells
Set b = r.Find(texto, lookat:=xlPart)
If Not b Is Nothing Then
ncell = b.Address
Do
contador = contador + 1
Set b = r.FindNext(b)
Loop While Not b Is Nothing And b.Address <> ncell
End If
h2.Range("B2") = contador
h2.Select
Application.ScreenUpdating = True
MsgBox "Fin contar"
End Sub
El proceso puede demorar algunos segundos en lo que se abre el pdf, se copia la información y se termina el conteo.
Revisa en tu archivo en la hoja2 el resultado.
Saludos. Dante Amor
No olvides valorar la respuesta.