Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 03-03-2013, 06:43 AM
gmaxey gmaxey is offline Rich Text Content Controls: Formatting? Windows 7 32bit Rich Text Content Controls: Formatting? Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Yes it was a typo. Paul's code applied the character style to the existing text of the control. To apply it to the control itself, you need to extended the start and end range by 1:

Code:
Sub Demo()
Dim oRng As Word.Range
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
    Set oRng = oControl.Range
    oRng.Start = oRng.Start - 1
    oRng.End = oRng.End + 1
    oRng.Style = oStyle.NameLocal
  End If
Next oControl
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Rich Text Content Controls: Formatting? Rich text/Plain text Content Controls in Template michael.fisher5 Word 9 11-19-2014 06:36 AM
Rich Text Content Controls: Formatting? How do you set rich text in a content control Testor Word VBA 4 07-08-2012 07:55 AM
Rich Text Content Controls: Formatting? Rich Text Content Control - Allow User Formatting keithacochrane Word 1 05-28-2012 05:06 PM
Rich Text Content Controls: Formatting? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft