Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-23-2022, 11:32 PM
Guessed's Avatar
Guessed Guessed is offline Tagging Highlighted text with appropriate color Windows 10 Tagging Highlighted text with appropriate color Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
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

Does this work for you?
Code:
Sub HighlightTagger()
  Dim aRng As Range
  Set aRng = ActiveDocument.Range
  With aRng.Find
    .Text = ""
    .ClearFormatting
    .Replacement.ClearFormatting
    .MatchWildcards = False
    .Forward = True
    .Wrap = wdFindStop
    .Highlight = True
    Do While .Execute
      Select Case aRng.HighlightColorIndex
        Case wdYellow
          aRng.InsertBefore "[Color: Yellow]"
        Case wdBlue
          aRng.InsertBefore "[Color: Blue]"
        Case Else
          aRng.InsertBefore "[Color: Other]"
      End Select
      If aRng.Characters.Last = vbCr Then
        aRng.Characters.Last.InsertBefore "[/Color]"
      Else
        aRng.InsertAfter "[/Color]"
      End If
      aRng.Collapse Direction:=wdCollapseEnd
    Loop
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 

Tags
highlight, highlight color



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tagging Highlighted text with appropriate color Text Field [content control] - Default text color vs Filled Text color jackcoletti Word 3 02-01-2017 08:10 AM
Tagging Highlighted text with appropriate color Cannot see highlighted text for moving text in a do ument Jonfrank1@me.com Project 1 01-09-2017 06:04 PM
Tagging Highlighted text with appropriate color I need to convert shaded text into highlighted text on about 80 different long documents. VBA macro? AustinBrister Word VBA 8 05-28-2015 02:42 PM
Tagging Highlighted text with appropriate color Formatting- Apply changes to highlighted text results in same change to other text sential Word 6 01-10-2014 03:22 PM
Macro for tagging and rearranging selected text for revision caotico Word VBA 0 03-28-2012 06:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:42 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