Use VBA to pull data from text box in XFA form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rugbykorn
    New Member
    • Mar 2012
    • 15

    Use VBA to pull data from text box in XFA form

    Hello,

    I am trying to do something relatively simple but as usual I am doing it using a new medium and have no idea what syntax I need to use.

    I have an XFA Form (a PDF created using Live Cycle Designer) which has several text boxes in it. I need to reference a specific text box (in this case "textbox14" - I didn't make the form so the text boxes don't have meaningful names) and pull the text that is entered in it. I will then use that text when saving the PDF so that the file name will contain the data from "textbox14" .

    I found a great resource with code samples on line for doing this with regular PDF's and the below code works fine to pull the data from a text box named "test1".

    Code:
    Private Sub Command0_Click()
        Dim AcroApp As Acrobat.CAcroApp
        Dim theForm As Acrobat.CAcroPDDoc
        Dim jso As Object
        Dim test As String
        
        Set AcroApp = CreateObject("AcroExch.App")
        Set theForm = CreateObject("AcroExch.PDDoc")
        theForm.Open ("C:\Documents and Settings\joseph.korn\Desktop\testPDF.pdf")
        Set jso = theForm.GetJSObject
        
        
        
        test = jso.getfield("test1").Value
        
        MsgBox test
    
        
        theForm.Close
         
        AcroApp.Exit
        Set AcroApp = Nothing
        Set theForm = Nothing
         
        MsgBox "Done"
    However I need to do the same thing with a PDF made using Live Cycle Designer and the resource I found mentions that PDF's created using 'Designer' require the use of the XFA DOM. I have been trying to figure this out using some HUGE PDF's released by Adobe but I'm not a developer / programmer by trade and would appreciate any help in figuring this out.

    Thanks!

    RugbyKorn
Working...