Consulting

Results 1 to 5 of 5

Thread: [HELP!!!] ABOUT PDF FILE

  1. #1
    VBAX Newbie
    Joined
    Jan 2005
    Posts
    3
    Location

    [HELP!!!] ABOUT PDF FILE

    Hi,
    want to know how to use VBA to control a PDF file, for example, to find a word in PDF and highlight it in yellow.

    thanks very much!!!!

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    You'll need to add the Acrobat Type Library in Tools|References, then you will have access to some of the Acrobat object model.
    As an example, I tested this with the following code run from Excel.
    Hopefully, this will get you started:
    [VBA]Sub FindTextInPDF()
    Dim AcroApp As CAcroApp
    Dim AVDoc As CAcroAVDoc
    Dim PDDoc As CAcroPDDoc
    Dim myPath As String
    Dim myString As String

    'you'll need to change this to an existing pdf file on your system
    myPath = "N:\Andy\connexions\re-view-02-04-04.pdf"

    Set AcroApp = CreateObject("AcroExch.App")
    Set AVDoc = CreateObject("AcroExch.AVDoc")

    AVDoc.Open myPath, ""
    Set PDDoc = AVDoc.GetPDDoc

    myString = InputBox("Enter text to search for:", "PDF Search")
    AVDoc.FindText myString, 0, 0, 0
    AcroApp.Show

    End Sub[/VBA]

    Have fun!
    K :-)

  3. #3
    VBAX Newbie
    Joined
    Jan 2005
    Posts
    3
    Location
    Sure, this could be good start for me!
    Thank you, Killian!

  4. #4
    VBAX Newbie
    Joined
    Jan 2005
    Posts
    3
    Location

    Question

    Hi Killian,
    There is no help information showing out when I press F1 in the VBA editor. It got me headache cause I am not familar with Acrobat objects' properties, methods and events. Could you tell me where I can access these information?

    Blessing
    Kidsing

  5. #5
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    No, there won't be a help file associated with the Acrobat stuff, however you can get useful info from the object browser (hit F2 for this). Do a search for "Acro" and then browse through the Acrobat objects. The details for the selected object are shown at the bottom of this screen so you can see what each thing does and it's arguments.

    For more details and questions, I've used the forum archive here:
    http://www.planetpdf.com/
    You might also want to Google around to see what else turns up

    Good luck
    K :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •