top of page

You can use the below macro to find and replace multiple strings in a Word document. Thanks to Graham Mayor for posting it here.

First create a Word table with the values you want to replace in the first column, and the value you want to add in the second column. Save and close it.

Plug the below macro into a new module in Visual Basic. Enter a path to the Word table which contains the find and replace pairs.

Enter the below VBA code in a macro and run it.

Sub ReplaceFromTableList() ' from Doug Robbins, Word MVP, Microsoft forums, Feb 2015, based on another macro written by Graham Mayor, Aug 2010 Dim oChanges As Document, oDoc As Document Dim oTable As Table Dim oRng As Range Dim rFindText As Range, rReplacement As Range Dim i As Long Dim sFname As String 'Change the path in the line below to reflect the name and path of the table document sFname = "C:\FooFolder\findreplace.docx" Set oDoc = ActiveDocument Set oChanges = Documents.Open(FileName:=sFname, Visible:=False) Set oTable = oChanges.Tables(1) For i = 1 To oTable.Rows.Count Set oRng = oDoc.Range Set rFindText = oTable.Cell(i, 1).Range rFindText.End = rFindText.End - 1 Set rReplacement = oTable.Cell(i, 2).Range rReplacement.End = rReplacement.End - 1 Selection.HomeKey wdStory With oRng.Find .ClearFormatting .Replacement.ClearFormatting .MatchWildcards = True .Text = rFindText.Text .Replacement.Text = rReplacement.Text .Forward = True .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll End With Next i oChanges.Close wdDoNotSaveChanges End Sub

The Word document is updated. Note that the macro is case sensitive.


 
 

Getting the numbering (or lettering) of exhibits in a brief can be maddening. Whether you have a brief referencing numerous exhibits, or are working with an attorney that decides to add and/or remove exhibits shortly before the filing deadline, putting the numbering or lettering in order and avoiding gaps can be a time consuming and frustrating experience. MS Word can automate the process by entering codes to keep track of the sequence of exhibits and account for insertions or deletions.

In MS Word 2016, follow these steps:

1. On the Reference tab, click on 'Insert Caption'.

2. In the dialog box which appears click on 'New Label' and add 'Exhibit', 'Ex.', 'Exh.' as necessary.

3. Click on 'Numbering' where you can choose either standard numbering; Roman numerals, or Latin letters.

4. If you have trouble getting the exhibit references to use the same font as the rest of the document, open up Styles (press CTRL + ALT + SHIFT + S) and right click on 'Caption' to modify the font.

5. Word will enter SEQ codes in the document.

6. If you press ALT + F9, the code references will be swapped with the actual exhibit references.

7. After removing an exhibit reference, update the SEQ codes by selecting all of the text in the document, right clicking, and hitting 'Update Field'

8. The exhibit references update automatically.


 
 

Don't miss out on the fact that Word records the previous contents of your clipboard. Go to the Home tab on the ribbon and on the far left, click on 'clipboard'. A panel will open on the left allowing you to select from the past several strings copied to your clipboard. The contents can still be viewed after the document has been saved and closed.


 
 

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