![]() |
|
#1
|
|||
|
|||
|
Hi, I'm trying to write a macro that will go through an entire document, find any text in red font and mark that text with an index code. I've tried many different variations of the code below, but nothing works correctly. This latest attempt just inserts blank index codes at the top of the document, one for each instance of every word in red text. I clearly have no idea what I'm doing. Can anyone help? Thank you in advance for any information.
Code:
Sub MarkIndexMacro()
Dim MyRange As Range
Selection.HomeKey Unit:=wdStory
Set MyRange = ActiveDocument.Range
With MyRange.Find
.Font.Color = wdColorRed
Do While .Execute
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, Entry:=Selection.Range.Text
Loop
End With
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro for mark index entry for every word in a document?
|
Jay Jay | Word VBA | 5 | 08-13-2015 03:44 PM |
| Hyperlinking from the Index to the Origin Mark | Phil H | Word | 2 | 08-30-2013 04:03 AM |
| Index Addition Leaves Hidden Codes On | SQLUSA | Word | 3 | 07-23-2012 02:58 AM |
| Options of Index Mark Entry | smaria | Word | 1 | 04-22-2010 05:48 AM |
| Macro to mark non-coloured/non-highlighted text as hidden | PeterB | Word | 0 | 10-28-2009 07:54 AM |