Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 10-15-2018, 06:38 AM
gmayor's Avatar
gmayor gmayor is offline Checkbox Highlight Option Windows 10 Checkbox Highlight Option Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
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 ofgmayor has much to be proud of
Default

In that case you will need a macro and a bookmark. Bookmark the text you want to highlight and call the Bookmark (say) BM1. Assuming the title of the checkbox control is Check1, the following macro goes in the ThisDocument module of the document. The macro files after you click outside the check box having checked or unchecked it.
You can add more case statements for other checkbox/bookmark combinations as required.



Code:
Option Explicit

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
    Select Case ContentControl.Title
        Case Is = "Check1"
            If ContentControl.Checked = True Then
                ActiveDocument.Bookmarks("BM1").Range.HighlightColorIndex = wdYellow
            Else
                ActiveDocument.Bookmarks("BM1").Range.HighlightColorIndex = wdNoHighlight
            End If
    End Select
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox Highlight Option One Content Control Checkbox checks another Content Control Checkbox DEsh Word VBA 2 10-06-2017 08:23 PM
Checkbox Highlight Option Checkbox in Userform lukael Excel Programming 5 02-18-2014 05:20 AM
find - reading highlight - highlight all / highlight doesn't stick when saved bobk544 Word 3 04-15-2009 03:31 PM
macro on checkbox macrohelp Word VBA 0 03-06-2009 03:33 PM
highlight cell after checkbox flatk Word 0 01-25-2007 12:32 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:17 PM.


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