How to select a specific field via vbscript
I'm looking to be able to select a specific field in a PDF and set it's value, as opposed to looping through all of the fields and looking for a specific field name (in VBScript (I'm just a sys admin trying to streamline a task involving filling out many PDF documents, I'm not a developer)
In other words, I'd like to replace this (which works):
On Error Goto 0
FileNm = "C:\Temp\DOC.pdf"
Set AVDoc = CreateObject("AcroExch.AVDoc")
If AVDoc.Open(FileNm,"") Then
Set pdDoc = avDoc.GetPDDoc()
Set PDFForm = CreateObject("AFormAut.App")
Set x = PDFForm.Fields
For Each myField In x
If myField.Name = "Text100" Then myField.Value = "something interesting"
Next
End If
with something like:
On Error Goto 0
FileNm = "C:\Temp\DOC.pdf"
Set AVDoc = CreateObject("AcroExch.AVDoc")
If AVDoc.Open(FileNm,"") Then
Set pdDoc = avDoc.GetPDDoc() 'actual PDF document
Set PDFForm = CreateObject("AFormAut.App")
Set x = PDFForm.Fields
Set myField= x.getfieldname("Text100") '<== this is the line I'm trying to figure out
myField.Value = "something interesting"
End If
Can it be done?
And thanks!
