Populate Fillable Form PDF from MS Access

巧了我就是萌 提交于 2019-12-24 06:55:05

问题


Having a problem with some VBA code I found on this site. It is to populate a field in a PDF fillable form document from MS Access. I adjusted the code best I could, but still getting an error.

Dim strTemplate, strPath, strDir, gApp, avDoc, pdDoc, jso

strPath = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\"))
strDir = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\"))
strDir = strDir & "Plans\" & Form_Plan_Frm!Cage & "\" & Form_Plan_Frm!UID
strTemplate = strPath & "Templates\test.pdf"

Set gApp = CreateObject("AcroExch.app")

Set avDoc = CreateObject("AcroExch.AVDoc")
If avDoc.Open(strTemplate, "") Then
    Set pdDoc = avDoc.GetPDDoc()
    Set jso = pdDoc.GetJSObject

    jso.getField("Form1[0].Pg1[0].Topinfo[0].UIDName[0]").Value = "37555-20170517-00001-00023"
    pdDoc.Save PDSaveIncremental, "Test.pdf" 'Save changes to the PDF document
    pdDoc.Close
End If

avDoc.Close (True)

Set gApp = Nothing
Set avDoc = Nothing
Set pdDoc = Nothing
Set jso = Nothing

The error I am getting on the line

jso.getField("Form1[0].Pg1[0].fieldName[0].UIDName(0)").Value = "37555-20170517-00001-00023"

"Run time error '424'; Object Required"

Below is a screenshot of what LiveCycle shows for the structure.

来源:https://stackoverflow.com/questions/45771955/populate-fillable-form-pdf-from-ms-access

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!