NauticalGent
Ignore List Poster Boy
- Local time
- Yesterday, 23:47
- Joined
- Apr 27, 2015
- Messages
- 6,763
Hello SportsFans, I've got one that really has me scratching my bald head, there HAS to be a way to do this...
The concept is simple: I want to fill a PDF with data from an unbound form. Using code the DBG's website, I was able to determine what the names of the PDF fields were and also get the code to "push" the values to it (nice work DBG!)
The issue is I want to build the series of commands and then use it as an argument to a public sub:
The reason I am not doing this within the Form's Class Module is that I want to make this dynamic for the many PDF forms the clients will be using.
Open to any suggestions here, I am not married to this concept, it is just the only way I cold think of.
Thanks in advance!
The concept is simple: I want to fill a PDF with data from an unbound form. Using code the DBG's website, I was able to determine what the names of the PDF fields were and also get the code to "push" the values to it (nice work DBG!)
The issue is I want to build the series of commands and then use it as an argument to a public sub:
Code:
Sub FillPDF(strData As String)
Dim gApp As Acrobat.AcroApp
Dim avDoc As Acrobat.AcroAVDoc
Dim pdDoc As Object
Dim jso As Object
Dim FileNm2 As String
FileNm = "\\Data\SubContractingPlan\Edit_DD2579_blank_form.pdf"
FileNm2 = "\\Data\SubContractingPlan\DD2579-BuyerName.pdf"
Set gApp = CreateObject("AcroExch.app")
Set avDoc = CreateObject("AcroExch.AVDoc")
If avDoc.Open(FileNm, "") Then
Set pdDoc = avDoc.GetPDDoc()
Set jso = pdDoc.GetJSObject
'Here is where I want to write the contents of the argument (strData) so the sub can execute them - here is an example of what one line would 'look like
'jso.getfield("form1[0].#subform[0].ctr_email[0]").Value = "john.clark@MyDomain.com"
pdDoc.Save 1, FileNm2
pdDoc.Close
End If
avDoc.Close (True)
Set gApp = Nothing
Set avDoc = Nothing
Set pdDoc = Nothing
Set jso = Nothing
End Sub
The reason I am not doing this within the Form's Class Module is that I want to make this dynamic for the many PDF forms the clients will be using.
Open to any suggestions here, I am not married to this concept, it is just the only way I cold think of.
Thanks in advance!