top of page

Word Macro to Remove AutoDates

Stipulations for the production of ESI may specify that MS Office files which use an autodate field be updated in order to avoid this field misleading reviewers about the actual date of the documents. See for example this stipulation in a federal case in West Virginia., which states that:

Microsoft “Auto” Feature. Microsoft Word (.doc) Microsoft Excel (.xls) and Microsoft PowerPoint (.ppt) documents should be analyzed for the “auto” features, where documents have an automatically updated date and time in the document that when processed 6 would be inaccurate for how the document was used in the ordinary course of business. If an “auto date” is identified, the producing party will make reasonable efforts to produce document branded with the words “Auto Date.”

The below macro will automatically replace date fields with the created date of the Word files.

Sub BatchFixDates() Dim myFile As String Dim PathToUse As String Dim myDoc As Document Dim iFld As Integer Dim fDialog As FileDialog Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog .Title = "Select Folder containing the documents to be modifed and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show <> -1 Then MsgBox "Cancelled By User" Exit Sub End If PathToUse = fDialog.SelectedItems.Item(1) If Right(PathToUse, 1) <> "\" Then PathToUse = PathToUse + "\" End With

If Documents.Count > 0 Then Documents.Close Savechanges:=wdPromptToSaveChanges End If myFile = Dir$(PathToUse & "*.do?")

While myFile <> "" Set myDoc = Documents.Open(PathToUse & myFile) ActiveWindow.View.ShowFieldCodes = True For iFld = ActiveDocument.Fields.Count To 1 Step -1 With ActiveDocument.Fields(iFld) If .Type = wdFieldDate Then .Code.Text = Replace(.Code.Text, "DATE", "CREATEDATE") .Update End If End With Next iFld ActiveWindow.View.ShowFieldCodes = False myDoc.Close Savechanges:=wdSaveChanges myFile = Dir$() Wend End Sub


bottom of page