0

Can anybody tell me how to set the value of a checkbox in a word document using OLE object?

I'm using form fields (dropdown and checkbox) in the Word document.

I am using PB 7.

Thanks!

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
XLD_a
  • 195
  • 1
  • 4
  • 16
  • It will depend a lot on what kind of checkbox. Word has at least three different checkboxes, all different technology. So how to address them via its object model is different for each. If you don't know "what kind" describe the steps used to insert the checkbox in the document. – Cindy Meister Jan 16 '16 at 16:41
  • Thank you for the answer. To respond to your question, for example, i have a drop down list with different choices. Based on the choice i'll make, in my word document i need that the checkbox for that option to be checked. I put the checkbox in the word document from Developer tab -> Legacy Tools -> Legacy Forms -> Check Box Form Field Thanks! – XLD_a Jan 17 '16 at 18:22

1 Answers1

0

I can't give you the exact PB syntax, but I can give you the Word object model syntax, which you shouldn't have any difficulty "translating".

oDocument.FormFields(index).CheckBox.Value = true  'or false

index can be either the position in the document (the nth form field in the text) or the name of the form field as a string ("Check1" for example).

Note that it's not possible to use the macro recorder to get this syntax since the macro recorder won't run in a document protected as a form and it's not possible to change the checkbox value if the document is not protected as a form.

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43