Question
PDF tags automation thru VBA
Hi guys, need your help. I am automating PDF and need to automate tags change/update.
In below code, there is no error encountered and the new PDF saved without issue
The problem is, the new tag is not applied in the new PDF document
Please give me advise how can I do it?
Thank you in advance
Public Sub renameTag()
Dim jsObject As Object
Dim objField As Object
Dim result As Boolean
Dim oneCell As Range
Dim testField
Set jsObject = pdfDoc.GetJSObject
For Each oneCell In wsTagReplace.Range("tblTagsReplace[Rename?]")
If oneCell.Value = 1 Then 'need to change/update tags
Set objField = jsObject.getField(currentTag)
objField.Name = newTag
End If
Next oneCell
result = pdfDoc.Save(PDSaveFull, Replace(fileName, ".pdf", "_new.pdf"))
Set objField = Nothing
Set jsObject = Nothing
End Sub