You can't delete individual documents, but if you want to clear the list,
use Tools/ Options/ General, and set Recently used file list to zero
entries. You can then set it back to a non-zero number to let it start a
new list.
This works ok for me in xl2003--but I've never tested it in xl2007.
Option Explicit
Sub testme()
Dim iCtr As Long
Dim MRUMax As Long
Dim TestStr As String
With Application.RecentFiles
MRUMax = .Maximum
For iCtr = .Count To 1 Step -1
TestStr = ""
On Error Resume Next
TestStr = Dir(.Item(iCtr).Path)
On Error GoTo 0
If TestStr = "" Then
.Item(iCtr).Delete
End If
Next iCtr
.Maximum = MRUMax
End With
Sub toggle_MRU()
With Application
.RecentFiles.Maximum = 1 'leaves current workbook on list
End With
With Application
.RecentFiles.Maximum = 5
End With
End Sub
Gord Dibben MS Excel MVP
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.