View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default how do I delete documents from the recent doccument box(excel)

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

End Sub


If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

john wrote:

how do I delete documents from the recent doccument box(excel)


--

Dave Peterson