
Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
> Hi group. I am working with ContentControls in Word 2007 and have now
> (once again) stumbled upon something peculiar.
[quoted text clipped - 31 lines]
> Reference link:
> http://msdn.microsoft.com/library/microsoft.office.tools.word.contentcontrol(en-
us).aspx
> Try using the control's .Range.Text property. I think it will do what you
> want -- at least, it appears to do so in VBA.
Well - the .Range property does indeed provide a handle to the textual
content in the control; but unfortunately it is a readonly property. I
need to be able to set the text as well as reading it (this is working
fine in my current code where I'm only working with
PlainTextContentControls, but the final template will have a mixture of
PlainText-, RichText- and DatePickerContentControls. For all of these
control types the same basic action (using get and set at the text
content in the control) is to be added on the Enter/Exit events.
To make things even more confusing, there is a note in the
documentation of the ContentControl.Range property referring to the
(nonexisting) .Text property:
| To access only the text that is displayed in the ContentControl, use
| the Text() property.
http://msdn.microsoft.com/library/microsoft.office.tools.word.contentcontrol.range
Who ate my Text property?

Signature
Jens Gyldenkærne Clausen
CBS IT
Svar venligst i gruppen.
Scott McPhillips [MVP] - 09 May 2008 22:09 GMT
>> Try using the control's .Range.Text property. I think it will do what you
>> want -- at least, it appears to do so in VBA.
>
> Well - the .Range property does indeed provide a handle to the textual
> content in the control; but unfortunately it is a readonly property.
No, it is not read-only:
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.range.text.aspx

Signature
Scott McPhillips [VC++ MVP]
Jens Gyldenkærne Clausen - 09 May 2008 22:19 GMT
> No, it is not read-only:
> http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.range.text.aspx
Ah - the range itself is readonly but the Range.Text is not. Excellent
- this looks like a perfect solution. Will try it out some time after
the pentecost holiday.
Thanks a lot for the answer.

Signature
Jens Gyldenkærne Clausen
CBS IT
Svar venligst i gruppen.