Clear Recently Used File List

Home Up Search This Site What's New? Audio On CDR Favourites Downloadable files Photo Gallery 2002 Photo Gallery 2003 Photo Gallery 2004/5 Photo Gallery 2006/7 Photo Gallery 2008 Photo Gallery 2009/10 UK Photo Gallery Ireland Photo Gallery Cats Photo Gallery 

 

 

Google
 

 

Many people access the material from this web site daily. Most just leech what they want and run. That's OK, provided they are not selling on the material as their own; however if your productivity gains from the material you have used, a donation from the money you have saved, however small, would help to ensure the continued availability of this resource.

Click the appropriate button above to access PayPal.

Clear Recently Used File List

Word does not provide an obvious way of deleting the contents of the recently used file list. You could use tools > options > general and uncheck the recently used file list box, (see below) or you could try one of the following macro solutions.

If you wish to selectively edit the list, then you can download an alternative version from the web site of my American friend Greg Maxey - http://gregmaxey.mvps.org/Recent_Files_List_Editor.htm.

Word 2003

The first macro may be used with all recent Word versions, but it is aimed primarily at versions prior to Word 2007 The later macro takes advantage of the extra functions that Word 2007 provides.

Sub ClearMRU()

'

' Macro created by Graham Mayor to clear Word's recently used file list.

' Updated 30 Oct 2009

Dim sAssistant As Boolean
Dim
sMsg1 As String
Dim
sMsg2 As String
Dim
sMsg3 As String
Dim
sMsg4 As String
 

sMsg1 = "This will delete your recently used file list"
sMsg2 = "OK, we won't do that then!"
sMsg4 = "Clear Recent File List"
 

sVer = Application.version
 

Application.DisplayRecentFiles = True
listsize = RecentFiles.Maximum
 

sMsg3 = "Your recent file list has been cleared and reset to hold " _
+ Str$(listsize) + " files."

If sVer < 12 Then 'Version is not Word 2007
    sAssistant = Assistant.Visible 'So use the Office Assistant
    If sAssistant = False Then
        With
Assistant
            .On = True
            .Visible = True
        End With
    End If

    Set Balloon = Assistant.NewBalloon
    With Balloon
        .Text = sMsg1
        .Button = msoButtonSetOkCancel
        .Animation = msoAnimationBeginSpeaking
        ButtonPressed = .Show
    End With
    If
ButtonPressed = -2 Then
        Set
Balloon = Assistant.NewBalloon
        With Balloon
            .Text = sMsg2
            .Button = msoButtonSetOK
            .Animation = msoAnimationGoodbye
            .Show
       End With
       GoTo
skipped
   End If
   If ButtonPressed = -1 Then
       RecentFiles.Maximum = 0
       RecentFiles.Maximum = listsize
       Set Balloon = Assistant.NewBalloon
       With Balloon
            .Text = sMsg3
            .Button = msoButtonSetOK
            .Animation = msoAnimationGetAttentionMinor
            .Show
       End With
   End If

skipped:
  Assistant.Visible = sAssistant
 

Else 'Word version is 2007
   Response = MsgBox(sMsg1, vbOKCancel, sMsg4)
   If Response = 1 Then
        RecentFiles.Maximum = 0
        RecentFiles.Maximum = listsize
        MsgBox sMsg3, vbInformation, sMsg4
   Else 'User cancelled
        MsgBox sMsg2, vbCritical, sMsg4
   End If
End If
End Sub


Note:

Watch out for prematurely broken lines when pasting the above macro into the macro editor.

 

If you don't know what to do with macro listings see - Installing Macros From Listings

Use tools > customize to add the macro to your Word 2000/2003 file menu as shown below.

Word 2007

 

Word 2007 offers a recent file list (above) which stores up to 50 items and to which users may pin items to prevent them from being replaced in the list as new items are added. The previous macro will work with Word 2007, but it will wipe all the items from the list, including the pinned items. 

The list is stored in the registry at HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\File MRU. Each item has a prefix which may be

[F00000000]
[F00000001]
[F00000002]

or
[F00000003]
as shown in the following illustration.

(There are no instances of [F00000003]  in this illustration).

 


An item prefixed [F00000000] is neither read only nor pinned to the list

If the item is pinned a '1' is added to the number thus "[F00000001]". If the item is Read Only, then a '2' is added to the list, thus "[F00000002]", and if the item is both read only and pinned the numbers are added to one another thus"[F00000003]". You can interrogate the registry entries with a macro to see what the last number of the prefix is and act accordingly.

The following macro takes advantage of this.

Sub ClearMRU2()

'Clear recent file list leaving the pinned items
Dim rFile As RecentFile
Dim WSHShell, RegKey, rKeyWord
Set WSHShell = CreateObject("WScript.Shell")
RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\File MRU\"
For Each rFile In RecentFiles
     rKeyWord = WSHShell.RegRead(RegKey & "Item " & rFile.Index)
     Select Case Mid(rKeyWord, 10, 1)
     Case Is
= 0, 2
         
rFile.Delete
     End Select
Next rFile
End Sub

 

The following version is essentially similar but adds a user warnings and gives the user the opportunity to retain (or clear) the pinned items when clearing the list.

 

Sub ClearMRU3()
Dim rFile As RecentFile
Dim WSHShell, RegKey, rKeyWord
Dim sMsg1 As String
Dim
sMsg2 As String
Dim
sMsg3 As String
Dim
sMsg4 As String
Dim
sMsg5 As String

Dim sMsg6 As String
Dim
sResponse As String
Dim
sPinned As String
Dim
sListsize As Long
sMsg1 = "This will delete your recently used file list"
sMsg2 = "OK, we won't do that then!"
sListsize = RecentFiles.Maximum
sMsg3 = "Your recent file list has been cleared and reset to hold " _
+ Str$(sListsize) + " files." & vbCr
sMsg4 = "Clear Recent File List"
sMsg5 = " Do you wish to retain the items pinned to the recent file list?"
sMsg6 = "Files pinned to the recent list have been retained."
sResponse = MsgBox(sMsg1, vbOKCancel, sMsg4)
If sResponse = 1 Then
     sPinned = MsgBox(sMsg5, vbYesNo, sMsg4)
     If sPinned = vbYes Then
          Set WSHShell = CreateObject("WScript.Shell")
          RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\File MRU\"
          For Each rFile In RecentFiles
               rKeyWord = WSHShell.RegRead(RegKey & "Item " & rFile.Index)
              
Select Case Mid(rKeyWord, 10, 1)
               Case Is
= 0, 2
         
          rFile.Delete
               End Select

          Next
rFile
          MsgBox sMsg3 & sMsg6, vbInformation, sMsg4
     Else
          For Each rFile In RecentFiles
               rFile.Delete
          Next rFile
          MsgBox sMsg3, vbInformation, sMsg4
     End If
Else

     MsgBox sMsg2, vbInformation, sMsg4
End If
End Sub

 

Destructive Cursor

You can remove individual items from the recently used file list (in fact from any menu - so use with care) by means of the destructive cursor. You activate this cursor with CTRL+ALT+- (hyphen) and dismiss it with ESC or by actually using it.

The cursor appears as a thick horizontal bar - as shown below:

Note:

The destructive cursor does not work on task pane entries.

If you accidentally remove a Word menu entry, you can replace it from tools > customize > commands. Select the required entry and drag it back to the menu.

  With the cursor displayed open the required menu - here the Work menu (as this cursor is the only means of removing entries from the Work menu).

   Click the left mouse button, and the entry is removed.

.