Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Type of Content Control
I am developing a template and have inserted several content controls.
However, they all look the same. Is there a way to tell what kind of content control I've added (e.g., rich text vs. plain text)? And is there a way to change from one type to another? I'm thinking of MS Access, where you have the ability to change a control to another type. Thanks, Jen |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Type of Content Control
JenC wrote:
I am developing a template and have inserted several content controls. However, they all look the same. Is there a way to tell what kind of content control I've added (e.g., rich text vs. plain text)? And is there a way to change from one type to another? I'm thinking of MS Access, where you have the ability to change a control to another type. Thanks, Jen Hi Jen, They don't really *all* look the same. The rich text and plain text ones look identical to each other, and the list box and combo box look the same as each other. But yes, it is hard to tell at a glance. One way to find what kind a particular text control is: Click inside it, then click the Properties button in the Controls group. The label of the third section of the dialog says either "Plain Text Properties" or "Rich Text Properties". Unfortunately, even that doesn't work to tell a list box from a combo box, since their Properties dialogs look the same, too. The only practical difference is that you can type into a combo box but not into a list box. VBA knows, though. You can put this macro in a global template and add a button for it to the Quick Access Toolbar. Sub ShowCCType() Dim CCs As ContentControls Dim strType As String Set CCs = Selection.Paragraphs(1).Range.ContentControls If CCs.Count 0 Then Select Case CCs(1).Type Case wdContentControlRichText strType = "Rich Text" Case wdContentControlText strType = "Plain Text" Case wdContentControlPicture strType = "Picture" Case wdContentControlComboBox strType = "Combo Box" Case wdContentControlDropdownList strType = "Dropdown List" Case wdContentControlDate strType = "Date Picker" Case wdContentControlBuildingBlockGallery strType = "Building Block Gallery" Case Else strType = "other" End Select MsgBox "This is a " & strType & " content control." End If End Sub -- 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. |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Type of Content Control
Jay Freedman wrote:
JenC wrote: I am developing a template and have inserted several content controls. However, they all look the same. Is there a way to tell what kind of content control I've added (e.g., rich text vs. plain text)? And is there a way to change from one type to another? I'm thinking of MS Access, where you have the ability to change a control to another type. Thanks, Jen Hi Jen, I forgot to answer your second question. You can change the type of a content control by macro code, within limits. For example, ActiveDocument.ContentControls(1).Type = wdContentControlRichText The help topic for the Type property of a content control explains: "You can use the Type property to change the type of a content control from one type to another. However, the ability to change the type of control depends on the original type and on the content inside the content control at the time of the change. All content controls can be changed to rich text or building block gallery type content controls because these types allow arbitrary content. For other types, if the content is valid for the type that you want to change to, then changing the type is allowed. Otherwise, the change is rejected, resulting in a run-time error." -- 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. |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Type of Content Control
Thanks Jay - this (and your previous message) is exactly what I was looking
for. Jen "Jay Freedman" wrote: Jay Freedman wrote: JenC wrote: I am developing a template and have inserted several content controls. However, they all look the same. Is there a way to tell what kind of content control I've added (e.g., rich text vs. plain text)? And is there a way to change from one type to another? I'm thinking of MS Access, where you have the ability to change a control to another type. Thanks, Jen Hi Jen, I forgot to answer your second question. You can change the type of a content control by macro code, within limits. For example, ActiveDocument.ContentControls(1).Type = wdContentControlRichText The help topic for the Type property of a content control explains: "You can use the Type property to change the type of a content control from one type to another. However, the ability to change the type of control depends on the original type and on the content inside the content control at the time of the change. All content controls can be changed to rich text or building block gallery type content controls because these types allow arbitrary content. For other types, if the content is valid for the type that you want to change to, then changing the type is allowed. Otherwise, the change is rejected, resulting in a run-time error." -- 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. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can you insert a content control in a footer? | Microsoft Word Help | |||
how can I add content control to a footer | Microsoft Word Help | |||
Exporting content control to Excel | Microsoft Word Help | |||
Content control prompt | Page Layout | |||
How do content control fields work? | Microsoft Word Help |