Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-22-2016, 01:56 PM
ciresuark ciresuark is offline Rich Text Content Contol retain Style Setting when whole document is changed Windows 7 32bit Rich Text Content Contol retain Style Setting when whole document is changed Office 2010 32bit
Novice
Rich Text Content Contol retain Style Setting when whole document is changed
 
Join Date: Oct 2014
Posts: 7
ciresuark is on a distinguished road
Default Rich Text Content Contol retain Style Setting when whole document is changed

Hello! I am working with a letter with various rich text and date pickers. The end user currently highlights the entire letter and chooses the correct font and size. There is one rich text content control I would like to have retain the style that is set up for it. When the whole document is selected the content control is included with it.

My goal is to write a macro to have the user click a button to highlight the whole document for them and change the font and size without having to edit this one content control.



Any help is appreciated.
Reply With Quote
  #2  
Old 02-22-2016, 06:25 PM
macropod's Avatar
macropod macropod is offline Rich Text Content Contol retain Style Setting when whole document is changed Windows 7 64bit Rich Text Content Contol retain Style Setting when whole document is changed Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

The correct way to do this is not to select the whole document and override the font attributes of the Style(s) used, but to modify the Style definitions. Accordingly, if you assign one Style to the whole of the document, except for the content control(s) of interest and another Style to the content control(s) of interest, all that would be needed is to change that one Style's definition. If, for example, everything except the content control is formatted with Word's 'Normal' Style, you could use a macro like:
Code:
Sub Demo()
Dim Fnt As Font
Set Fnt = ActiveDocument.Styles("Normal").Font
With Application.Dialogs(wdDialogFormatDefineStyleFont)
  If .Show = -1 Then
    Fnt.AllCaps = .AllCaps
    Fnt.Animation = .Animations
    Fnt.Bold = .Bold
    Fnt.BoldBi = .BoldBi
    Fnt.Color = .ColorRGB
    Fnt.DiacriticColor = .DiacColor
    Fnt.DoubleStrikeThrough = .DoubleStrikeThrough
    Fnt.Emboss = .Emboss
    Fnt.Engrave = .Engrave
    Fnt.Hidden = .Hidden
    Fnt.Italic = .Italic
    Fnt.Kerning = .Kerning
    Fnt.Name = .Font
    Fnt.Outline = .Outline
    Fnt.Position = Selection.Font.Position
    Fnt.Scaling = Selection.Font.Scaling
    Fnt.Size = .Points
    Fnt.Shadow = .Shadow
    Fnt.SmallCaps = .SmallCaps
    Fnt.StrikeThrough = .StrikeThrough
    Fnt.Superscript = .Superscript
    Fnt.Subscript = .Subscript
    Fnt.Spacing = Selection.Font.Spacing
    Fnt.Underline = .Underline
    Fnt.UnderlineColor = .UnderlineColor
  End If
End With
End Sub
As you can see, this allows you to capture and update far more than just a change to the name and point size.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro (or something) to run Spell Check within rich text content boxes in lock document NMBELL Word 8 12-21-2015 04:09 PM
Rich Text Content Contol retain Style Setting when whole document is changed Rich text/Plain text Content Controls in Template michael.fisher5 Word 9 11-19-2014 06:36 AM
Using both rich and plain content controls in one document Erica.Black Word 0 06-18-2013 10:33 AM
Rich Text Content Contol retain Style Setting when whole document is changed How do you set rich text in a content control Testor Word VBA 4 07-08-2012 07:55 AM
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 11:10 PM.


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