Find a number on PDF next to the text Found

macb

Board Regular
Joined
Jan 1, 2003
Messages
61
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone:

I need some help. I have the following to find some specific text on a pdf. It works fine. I want get the value just below the text found. On PDF I have a table and top row is the heading and next row is a value. I want to search the text (heading) and bring the value just below the heading. Any help will be really appreciated. Thanks

Code:
Sub PDFyo()

Dim gAvDoc As Acrobat.AcroAVDoc
Dim a As Acrobat.AcroPDTextSelect
Dim gPDFPath As String
Dim foundText As Integer
Dim Rsp

gPDFPath = "N:\ABC.pdf" '"C:\......" ' FILL IN PATH TO YOUR PDF HERE


Set gAvDoc = CreateObject("AcroExch.AVDoc")

If gAvDoc.Open(gPDFPath, "") Then
    sText = "BM"
    foundText = gAvDoc.FindText(sText, 1, 0, 1) 'Returns -1 if found, 0 otherwise
Else

    Rsp = MsgBox("Cannot open" & gPDFPath, vbOKOnly)
End If

If foundText = -1 Then
    sStr = "Found " & sText
    resp = MsgBox(sStr, vbOKOnly)
End If



End Sub

Macb
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi

If this is not possible - is it possible to copy a table from a particular page of a PDF document.

My PDF doc has 6 pages and the table needs to bring from 3rd page.


Any help will be appreciated.


Macb
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top