Checkbox set in vba not set on reopen of form
Copy link to clipboard
Copied
Hello I am setting these checkboxes programmatically in Excel and on first pass they are set. However when I reopen the document after saving they are not set. I was wondering is there a way to set them and keep them set the way I programmed them to be.
Code adapted from:
https://myengineeringworld.net/2013/10/read-and-write-pdf-forms-from-excel-vba.html
'All checkboxes to checked
objJSO.GetField(strFieldNames(22)).Value = 1
objJSO.GetField(strFieldNames(23)).Value = 1
objJSO.GetField(strFieldNames(24)).Value = 1
objJSO.GetField(strFieldNames(25)).Value = 1
objJSO.GetField(strFieldNames(26)).Value = 1
objJSO.GetField(strFieldNames(27)).Value = 1
objJSO.GetField(strFieldNames(28)).Value = 1
objJSO.GetField(strFieldNames(52)).Value = 1
Copy link to clipboard
Copied
It would be helpful if you specify which part of the macro is this.
According to the the link where you grabbed the code from there are two codes; One is for reading the PDF the other one is for writing to the PDF.
So when you say the first pass, does this mean that the ReadPDF portion of the code works but not the WritePDF code?
Copy link to clipboard
Copied
It was the write section. To resolve the problem I recreated the form and that eliminated the issue. I was using the form straight from the VA.
Copy link to clipboard
Copied
Hey that's great!
Thanks for sharing your feedback.
Don't forget to mark your answer as correct.

