Я хочу получить значение «всплывающей подсказки» и «заблокированное» значение из формы PDF, код работает без отмеченной строки:
ActiveCell.Value = objField.Locked ''''' here is the problem, need the property name
строка находится внутри этой функции:
Sub getPDFFields()
'base code: http://myengineeringworld.net/2013/10/read-and-write-pdf-forms-from-excel-vba.html
'Declaring the necessary variables.
Dim strPDFPath As String
Dim objAcroApp As Object
Dim objAcroAVDoc As Object
Dim objAcroForm As Object
Dim objobjFields As Object
Dim objField As Object
'Specify the path of the sample PDF form.
'Using workbook path:
strPDFPath = ThisWorkbook.PATH & "\" & "ALL_Forms.pdf"
On Error Resume Next
'Initialize Acrobat by creating the App object.
Set objAcroApp = CreateObject("AcroExch.App")
'Check if the object was created.
If Err.Number <> 0 Then
MsgBox "Could not create the App object!", vbCritical, "Object error"
'Release the object and exit.
Set objAcroApp = Nothing
Exit Sub
End If
'Create the AVDoc object.
Set objAcroAVDoc = CreateObject("AcroExch.AVDoc")
'Check if the object was created.
If Err.Number <> 0 Then
MsgBox "Could not create the AVDoc object!", vbCritical, "Object error"
'Release the objects and exit.
Set objAcroAVDoc = Nothing
Set objAcroApp = Nothing
Exit Sub
End If
On Error GoTo 0
'Open the PDF file.
If objAcroAVDoc.Open(strPDFPath, "") = True Then
'Show the application.
objAcroApp.Show
On Error Resume Next
'Create the Acrobat Form object.
Set objAcroForm = CreateObject("AFormAut.App")
'Check if the object was created.
If Err.Number <> 0 Then
MsgBox "Could not create the AFormAutobject!", vbCritical, "Object error"
'Release the objects and exit.
Set objAcroAVDoc = Nothing
Set objAcroApp = Nothing
Exit Sub
End If
On Error GoTo 0
'Get the fields of the form.
Set objobjFields = objAcroForm.Fields
'Print the number of form fields.
'ActiveCell.Value = "Total form Fields = " & objobjFields.Count
'ActiveCell.OFFSET(1, 0).Select
i = 1
For Each objField In objobjFields
'Print the name of the fields, values and their type (if there are any).
'will print them in table like form starting at the active cell
ActiveCell.Value = objField.Name
ActiveCell.OFFSET(0, 1).Select
ActiveCell.Value = objField.Value
ActiveCell.OFFSET(0, 1).Select
ActiveCell.Value = objField.Type
ActiveCell.OFFSET(0, 1).Select
ActiveCell.Value = objField.Locked ''''' here is the problem, need the property name
ActiveCell.OFFSET(1, -3).Select
Next objField
Else
Debug.Print "Could not open the file!"
'Close the Acrobat application.
objAcroApp.Exit
'Release the objects and exit.
Set objAcroAVDoc = Nothing
Set objAcroApp = Nothing
Exit Sub
End If
'Close the form without saving the changes.
objAcroAVDoc.Close True
'Close the Acrobat application.
objAcroApp.Exit
'Release the objects.
Set objAcroPDDoc = Nothing
Set objField = Nothing
Set objobjFields = Nothing
Set objAcroForm = Nothing
Set objAcroAVDoc = Nothing
Set objAcroApp = Nothing
End Sub
Я не уверен, как получить «всплывающую подсказку» в поле PDF или «заблокированный статус?»
![field props in Adobe PDF](https://i.stack.imgur.com/WD0Wt.jpg)