View Single Post
 
Old 03-03-2013, 12:46 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,384
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
If you only want to apply it to some Rich Text content controls, you'll need additional rules you can test with If statements. For example, any one or more of the Section of the document, the Rich Text content control's title, a bookmarked range could be used.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 03-03-2013 at 12:49 AM. Reason: Minor code enhancement
Reply With Quote