Reputation: 13
I can set string fields:
Dim msWord As New Microsoft.Office.Interop.Word.Application
Dim doc As Microsoft.Office.Interop.Word.Document
This works fine:
doc.Bookmarks("InitialsSecurityClass108").Range.Text = _ WordDocDAta.InitialsSecurityClass108
But this doesn't work:
doc.Bookmarks("chkSecurityClass101").Range.Text = .chkSecurityClass101
I just want to check a box on my Word form. I can't even find the "Range" property.
I've searched:
Stack
the object browser in VS Studio
Upvotes: 1
Views: 1580
Reputation: 25683
When working with form fields it's better to address the formfield object rather than the bookmark name. The bookmark name serves as the index value for the FormFields collection.
For example:
doc.FormFields("InitialsSecurityClass108").Result = "Text in textbox"
doc.FormFields("chkSecurityClass101").CheckBox.Value = true
Upvotes: 0
Reputation: 1713
It looks like you might be indicating there is a bookmark that surrounds a Checkbox Content Control in your document? If that is true then to mark the Checkbox you'll need code such as this ...
doc.Bookmarks("chkSecurityClass101").Range.ContentControls(1).Checked = True
Upvotes: 1