Skip to main content
Participant
March 20, 2020
Answered

Use VBA to get a dropdown list value

  • March 20, 2020
  • 1 reply
  • 867 views

Hello All,

I am using the JSO object and get field method to retrieve the values of dropdown lists from a form and place them into a variable which is then placed in a spreadsheet. In the following code the mobjJSO has already been initialized.  The value of the array is the name of the dropdown list  that is Skill_1.  I have confirmed the name and that it is on the PDF form.  I have other dropdowns that this appears to work correctly to bring back the value, but for this one I actually get the number of item that was chosen in the listing instead of the text.  For instance, if the user chose Data Entry below returns a 2 for the second item in the list instead of "Data Entry".  Does anybody know what I am doing wrong?  I just can't seem to get this to work.  

strValue = mobjJSO.getField(mobjLookupArray(i, 0)).Value  

Thank you!

Thayana

This topic has been closed for replies.
Correct answer Thom Parker

Did you check the export values in the list?  This is what is returned as the value of the list field. 

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
March 24, 2020

Did you check the export values in the list?  This is what is returned as the value of the list field. 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
ThayanaAuthor
Participant
March 25, 2020

Thanks! That was it.