Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
JenC JenC is offline
external usenet poster
 
Posts: 34
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
JenC JenC is offline
external usenet poster
 
Posts: 34
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can you insert a content control in a footer? Suzanne Microsoft Word Help 3 August 31st 09 10:15 PM
how can I add content control to a footer Suzanne Microsoft Word Help 3 June 20th 09 05:50 AM
Exporting content control to Excel Mr. Matt Microsoft Word Help 2 March 8th 09 09:40 AM
Content control prompt DRob Page Layout 4 May 7th 08 02:25 AM
How do content control fields work? piersonal Microsoft Word Help 14 January 17th 08 09:45 PM


All times are GMT +1. The time now is 08:06 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"