Windows Vista Forums

Script to read information inside a pdf file

  1. #1


    Alex St-Pierre Guest

    Script to read information inside a pdf file

    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

    --
    Alex St-Pierre

      My System SpecsSystem Spec

  2. #2


    Tom Lavedas Guest

    Re: Script to read information inside a pdf file

    On Oct 7, 11:46*am, Alex St-Pierre
    <AlexStPie...@newsgroup> wrote:

    > 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
    >
    > --
    > Alex St-Pierre
    Try something like ...

    AppActivate dReturnValue 'Activate the .pdf
    Application.ReturnToTheBeginningOfTheFile (Can be done using Shift-
    Tab...)
    For i = 1 To nTextBoxes
    GetText i, 1
    Next
    End Sub

    Sub GetText(nRow, nCol)
    Application.SendKeys "{TAB}^c", True ' Copies form data
    ThisWorkbook.Sheets("Sheet1").Paste _
    ThisWorkbook.Sheets("Sheet1").Cells(nRow, nCol)
    End Sub

    _____________________
    Tom Lavedas

      My System SpecsSystem Spec

Script to read information inside a pdf file

Similar Threads
Thread Forum
Free Inside information about the Latest Games and Gaming. 00015
This is a free inforation portal that I set up with dynamic and constantly updating articles and information. Do a search, find cheats, hidden codes...
Vista Games
Free Inside information about the Latest Games and Gaming. 85862
This is a free inforation portal that I set up with dynamic and constantly updating articles and information. Do a search, find cheats, hidden codes...
Vista Games
How to retrieve the script name inside Powershell?
$args contains the passing arguements, but no script name. How to get the script name inside itself in Powershell? Thanks!
PowerShell
batch file / script to replace information
I was trying to setup a batch file (.bat or .cmd, etc.) to go into an excel cvs file and replace text. the cvs file will always be in the same...
VB Script
How can I resolve %WINDIR% inside a PowerShell script?
I want to run this command from within a PowerShell script: fsutil hardlink create %WINDIR%\system32\windowspowershell \v1.0\psh.exe...
PowerShell
change permission on all files inside a folder or hundreds of file inside a folder
How can I change permission on all files inside a folder, or change permissions of hundreds of files inside a folder? I know how to change one...
Vista security
System information inside, help on reintall of Vista requested
I went through a long process with some very helpful people on this site to attempt to get my Windows Media Player up and running again. It was...
Vista General