View Single Post
 
Old 10-14-2020, 07:26 PM
Guessed's Avatar
Guessed Guessed is online now Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,980
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

You would need macros to do this via buttons since they aren't built-in. You can do a series of macros to toggle the colours. There is a finite number of highlight colours but if you know the available constant names for the colours then you just build another macro for each one.
Code:
Sub HL1()
  SetHiLite wdYellow
End Sub

Sub HL2()
  SetHiLite wdBrightGreen
End Sub

Function SetHiLite(iCol As Long)
  If Selection.Range.HighlightColorIndex = iCol Then
    Selection.Range.HighlightColorIndex = wdNoHighlight
  Else
    Selection.Range.HighlightColorIndex = iCol
  End If
End Function
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote