Complete .PDF form in VBA

A

Alex St-Pierre

Hi !
I can open a pdf file in VBA using the following code. Is there a way to
copy a text in a specific box inside the .pdf (the pdf file has boxes that
need to be completed). I don't need to save the pdf file (just open it and
complete it)
Is there a Adobe library that can be used to select box#1, #2, etc.
Thank's a lot!
Alex

Dim myIE As Object
Set myIE = CreateObject("InternetExplorer.Application")

myURL = "C:\myPdfFile.pdf"
On Error Resume Next
myIE.navigate myURL
myIE.Visible = True
On Error GoTo 0
 
A

Alex St-Pierre

Hi !
I use the following VBA programmation to complete a pdf form (using
SendKeys). Once the form is completed, the users can make modifications.
After the form has been modified, the user return in Excel and save the pdf
parameters. Is there a way to catch the selection content of a pdf file? When
the PDF document is activated, the command Application.SendKeys send the
value in the PDF document but Application.Selection doesn't return the PDF
selection. Any idea?

Actual VBA code to modify a pdf document:
Dim myIE As Object
Dim dReturnValue As Double
Set myIE = CreateObject("InternetExplorer.Application")
myIE.navigate "http:\\... \file.pdf 'Open the pdf
myIE.Visible = True
dReturnValue = Shell("IEXPLORER.EXE", vbNormalFocus)
AppActivate dReturnValue 'Activate the pdf
Application.SendKeys "{TAB}", True
Application.SendKeys "TEXTVALUE1", True
Application.SendKeys "{TAB}", True
Application.SendKeys "TEXTVALUE2", True
etc.
I would like something that do the same steps but record the selection in
each pdf cell's like:
'Save PDF information
AppActivate dReturnValue 'Activate the .pdf
Application.ReturnToTheBeginningOfTheFile (Can be done using Shift-Tab...)
Application.SendKeys "{TAB}", True
vInformation = Application.Selection 'This doesn't word (???)
Thisworkbook.Sheets("Sheet1").Cells(1,1) = vInformation
AppActivate dReturnValue 'Activate PDF
Application.SendKeys "{TAB}", True
vInformation = Application.Selection 'Read the contents of the box #2
Thisworkbook.Sheets("Sheet1").Cells(2,1) = vInformation
etc.

Thank's a lot!
Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top