Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-21-2018, 02:58 PM
kevinbradley57 kevinbradley57 is offline Partial bold formatting of content control Windows 7 64bit Partial bold formatting of content control Office 2010 64bit
Advanced Beginner
Partial bold formatting of content control
 
Join Date: Jul 2017
Posts: 84
kevinbradley57 is on a distinguished road
Default Partial bold formatting of content control


Is there a way to format just part of a drop-down content control so the text is bold? For example, we want the user to select a name from the drop-down, and the last name to be in bold text.
Reply With Quote
  #2  
Old 05-21-2018, 04:42 PM
Guessed's Avatar
Guessed Guessed is offline Partial bold formatting of content control Windows 10 Partial bold formatting of content control Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,967
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

If it was a Rich Text Content Control the answer would be Yes.

But a combobox CC is not that flexible AFAIK
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 05-21-2018, 05:10 PM
macropod's Avatar
macropod macropod is offline Partial bold formatting of content control Windows 7 64bit Partial bold formatting of content control 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

It can be done via a ContentControlOnExit macro, but it's hardly intuitive:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
With CCtrl
  .Type = wdContentControlRichText
  .Range.Font.Bold = False
  .Range.Words.First.Font.Bold = True
  .Type = wdContentControlDropdownList
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 05-21-2018, 06:09 PM
Guessed's Avatar
Guessed Guessed is offline Partial bold formatting of content control Windows 10 Partial bold formatting of content control Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,967
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Very clever Paul

It even retains the list entries despite converting to Rich Text and then back again so it looks robust enough to use. The user will likely need to modify the macro to restrict it to just that particular CC.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 05-21-2018, 07:56 PM
gmayor's Avatar
gmayor gmayor is offline Partial bold formatting of content control Windows 10 Partial bold formatting of content control Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If there is more than one control in the document then it must be limited to the control either by checking against the current control's title or tag. It is also advisable to check whether the control is showing the placeholder text e.g.


Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
    With CCtrl
        If CCtrl.Title = "Names" Then    'the name of the control
            If CCtrl.ShowingPlaceholderText = False Then
                .Type = wdContentControlRichText
                .Range.Font.Bold = False
                .Range.Words.First.Font.Bold = True
                .Type = wdContentControlDropdownList
            Else
                .Range.Font.Bold = False
            End If
        End If
    End With
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 05-21-2018, 09:22 PM
macropod's Avatar
macropod macropod is offline Partial bold formatting of content control Windows 7 64bit Partial bold formatting of content control 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

Do note that the demo code I posted (merely as a proof-of-concept) bolds the first word, but the OP wants the last word bolded...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Partial bold formatting of content control Is there a way to anchor drop-down content control boxes so entering text doesn't change formatting? TzarChasm Word 7 04-14-2016 06:28 PM
Partial bold formatting of content control How to do a find and replace on formatting for partial word formatting. BrianSvanvik Word 2 09-04-2015 01:20 PM
Partial bold formatting of content control Clicking the selected Content Control checkbox returns wrong control in vba event DougsGraphics Word VBA 2 06-24-2015 07:31 AM
Partial bold formatting of content control Deleting a table from a content control -- preserving the content control BrainSlugs83 Word Tables 8 11-14-2013 03:06 AM
Partial bold formatting of content control Rich Text Content Control - Allow User Formatting keithacochrane Word 1 05-28-2012 05:06 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:52 AM.


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