Reputation: 53
I have a word document contains some content control (Rich text, check boxes). Normally I can call content control:
ActiveDocument.ContentControls.item(1).Range.Text = "something"
ActiveDocument.ContentControls.item(1).Checked = True
But some of the control inside shapes (text box) and they can not be called this way.
How can I use these controls?
Upvotes: 0
Views: 607
Reputation: 53
Unfortunately, the answer was not that simple. But I managed to solve the problem. The shapes was grouped, that was the main problem. I had to ungroup them and after that
ActiveDocument.Shapes.Item(1).Select
Selection.Range.ContentControls.Item(1).Checked := True
Thank for the help anyway.
Upvotes: 1
Reputation:
Word has a number of different "StoryRanges" (the main body text "Story", various Header/Footer Stories, and so on. In this case the Controls are not in the Main Body story and you need to specify where they are. e.g. in the case you mention I think you will find them in
ActiveDcouemnt.StoryRanges(wdTextFrameStory).ContentControls
but if, for example, the textboxes are in a Header you may need to use a different StoryRange.
Upvotes: 1