View Full Version : [HELP!!!] ABOUT PDF FILE

01-05-2005, 09:30 PM
:) 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.:dunno

thanks very much!!!!

01-12-2005, 10:19 AM
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:
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

End Sub

Have fun!

01-12-2005, 10:17 PM
Sure, this could be good start for me!
Thank you, Killian!:hi:

01-12-2005, 10:27 PM
Hi Killian,:mkay
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?


01-13-2005, 04:21 AM
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:
You might also want to Google around to see what else turns up

Good luck