![]() |
|
|
|
#1
|
||||
|
||||
|
I'd suggest using a character Style rather than a paragraph Style, as it means you can use this Style in paragraphs that are otherwise formatted differently.
Here's how you can apply it to all Rich Text content controls: Code:
Sub Demo()
Dim oStyle As Style, oControl As ContentControl
Set oStyle = ActiveDocument.Styles.Add("RTCCStyle", wdStyleTypeCharacter)
With oStyle
.QuickStyle = True
.Font.Underline = wdUnderlineThick
.Font.UnderlineColor = wdColorBlack
.Font.Italic = True
.Font.ColorIndex = wdRed
End With
For Each oControl In ActiveDocument.ContentControls
If oControl.Type = wdContentControlRichText Then
oControl.Range.Style = = oStyle.NameLocal
End If
Next oControl
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] Last edited by macropod; 03-03-2013 at 12:49 AM. Reason: Minor code enhancement |
|
#2
|
|||
|
|||
|
What are the differences between Character Style and Paragraph Style? I've been wondering.
|
|
#3
|
|||
|
|||
|
Code:
oControl.Range.Style = = oStyle.NameLocal And, After running the codes, I discover in the Properties of the Rich Text Controls. The "use a style to format contents" has not been checked, which means if you type anything inside the formatted Rich Text Controls, the newly typed texts won't be as formatted as expected (in this case, not turned red, still auto black). |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Rich text/Plain text Content Controls in Template
|
michael.fisher5 | Word | 9 | 11-19-2014 06:36 AM |
How do you set rich text in a content control
|
Testor | Word VBA | 4 | 07-08-2012 07:55 AM |
Rich Text Content Control - Allow User Formatting
|
keithacochrane | Word | 1 | 05-28-2012 05:06 PM |
Grouping Content Controls
|
cksm4 | Word VBA | 2 | 03-01-2011 12:46 PM |
| Templates: automatic text generation from Rich Text content control | Chickenmunga | Word | 0 | 10-01-2008 11:16 AM |