top of page

I tested it out this week and the below VBA code posted by Graham Mayor here, will successfully remove XE codes from a Word document.

Sub Macro1() Dim oFld As Field Dim strFldText Dim strAsk As String Dim bHidden As Boolean With ActiveWindow.View bHidden = .ShowHiddenText .ShowHiddenText = True End With For Each oFld In ActiveDocument.Range.Fields If oFld.Type = wdFieldIndexEntry Then oFld.Select strFldText = Replace(oFld.Code, "XE ", "") strAsk = MsgBox("Delete " & strFldText, vbYesNoCancel) If strAsk = vbYes Then oFld.Delete ElseIf strAsk = vbCancel Then GoTo Finish End If End If Next oFld Finish: With ActiveWindow.View .ShowHiddenText = bHidden End With End Sub


 
 

The Tip of the Night for May 26, 2015, discussed how to use the Add-in for Word, Notestripper, to help facilitate the insertion of hyperlinks in footnotes of a MS Word document. After the text of footnotes is stripped out to text at the end of a document, you may receive an error message from NoteSripper indicating that the number of note references does not match the number of notes when you try to convert them back to notes.

If this happens try the following. First search for blank spaces formatted as superscript using the Find tool in Word. (Go to the Format menu, select Font, and check off the 'superscript' box.) Any footnote number with a blank space before it will throw off Notestripper.

The Add-in will not read the notes themselves if any text is crossed out or marked for deletion with track changes in Word. Be sure to re-format this text and the text on the following line, or Notestripper will not read each separate line of notes.


 
 

You can make use of a macro to select all of the text highlighted in a specific color in a Word document. The macro itself turns text highlighted in a selected color to a different font color - in this example red. This will help you export out (or copy just the text highlighted in one color) because you can search for text with in a particular font color, but not text highlighted in a particular color.

Press ALT + F11 to enter Visual Basic and enter the code below (posted to Word Banter by Dawn Crosler) in a new module

On the line reading:

If Selection.Range.HighlightColorIndex = wdYellow Then

. . . you can designate the color highlighting you want to process. See a list of different highlighting colors in Crosler's post.

Once the color of the text has been changed you can run a search in Word for just text with the font color red. Use the option for Find In . . . Main Document.

All of the search results will be selected. You can then copy them out for analysis.

Sub ChangeHighlight()

'Purpose: Changes highlight colors in a doc...need to change

'WD color index

'Changes the font color based on selected highlight color

'***********************

'go to top of doc

Selection.HomeKey Unit:=wdStory

'clear previous find

Selection.Find.ClearFormatting

'set search for highlight on

Selection.Find.Highlight = True

'run search

Selection.Find.Execute

'while highlights are still found

While Selection.Find.Found = True

'if highlight is "wdBrightGreen" (color to find) then

'change the wdBrightGreen in the line below to match the Color

'of highlight you desire. Use the wdColorIndexConstant List

'as inspiration

If Selection.Range.HighlightColorIndex = wdYellow Then

'change Selected Text Font to White

'Use the wdColorIndexConstant List to change to the

'appropriate font color

Selection.Range.Font.Color = wdColorRed

End If

'continue same search

Selection.Find.ClearFormatting

Selection.Find.Highlight = True

Selection.Find.Execute

'end loop when no more found

Wend

'move back to top of doc when done

Selection.HomeKey Unit:=wdStory

End Sub


 
 

Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page