Saving Word document with automatic Document Inspector

Here’s how to save a Word document with the private and hidden details automatically removed.

Normally, you’re expected to manually go to File | Info | Inspect document to check/remove things like comments, hidden text, header, footers or watermarks.

What if you want it to happen automatically, whenever you save a file or just make it more accessible than clicking around the Backstage pane?

Inspect Document on the QAT

Buried on the long list of Quick Access Toolbar commands is Inspect Document.

Go to Customize Quick Access Toolbar, choose All Commands then scroll down to Inspect Document.

Now just click the QAT button and Inspect Document appears.

Fully Automating Inspect Document with Save

There’s no direct equivalent of Inspect Document in Word’s VBA but it’s possible to combine commands.  In fact, a VBA function gives you more options.

This custom function ends with a Save command.  Unlike the Inspect Document option which doesn’t save at the end.

It also changes some document properties or options that aren’t available on the ribbon.  These properties stop Word saving personal info or date/time in the document.

Sub InspectTheDocument()

' based on code from Bernadette at

Dim docStatus As MsoDocInspectorStatus

Dim results As String

Dim ComboResults As String


' Turn off Tracking and accept all changes.

Application.ActiveDocument.TrackRevisions = False



' Removes all document metadata and 'extras'

Application.ActiveDocument.RemoveDocumentInformation (wdRDIAll)


' OR be more selective with statements like

'Application.ActiveDocument.RemoveDocumentInformation (wdRDIComments)

'Application.ActiveDocument.RemoveDocumentInformation (wdRDIDocumentProperties)

' Application.ActiveDocument.RemoveDocumentInformation (wdRDIRemovePersonalInformation)


' These two lines change document properties so that

' Personal Info or Date/Time are not saved in future

Application.ActiveDocument.RemovePersonalInformation = True


Application.ActiveDocument.RemoveDateAndTime = True


' Collapsed Headings

ActiveDocument.DocumentInspectors(1).Fix docStatus, results

ComboResults = results


' Headers, Footers and Watermarks

ActiveDocument.DocumentInspectors(3).Fix docStatus, results

ComboResults = ComboResults & results


' Comment this out unless you want the interruption

MsgBox ("The following items were removed " & ComboResults)

' display on status bar

Application.StatusBar = "Removed:" & ComboResults


' save the document



End Sub


.RemoveDocumentInformation parameters

The method Application.ActiveDocument.RemoveDocumentInformation () has many options or enumerations available.

Use Application.ActiveDocument.RemoveDocumentInformation (wdRDIAll) to remove all extra document info.

Or use a series of commands to select exactly what you want removed.

99        Removes all document information.

 1          Removes document comments.

16        Removes content type information.

 15        Removes document management policy information.

8          Removes document properties.

14        Removes document server properties.

10        Removes document workspace information.

5          Removes e-mail header information.

11        Removes ink annotations.

4          Removes personal information.

2          Removes revision marks.

6          Removes routing slip information.

7          Removes information stored when sending a document for review.

9          Removes template information.

17        Removes taskpane web extensions information.

3          Removes document version information.