home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "CleanHistory"
- ' Cleans history on file menu - if file cannot be seen, it is removed from the list.
- Sub CleanRecentFileList()
- Dim rf As RecentFile, FullName As String
- Const CLEARABSENTNETDOCS As Boolean = True ' Change to False to retain docs on absent network drives
- Const CLEARABSENTREMOVABLES As Boolean = True ' Change to False to retain docs on absent removable drives
- For Each rf In RecentFiles
- FullName = rf.Path & Application.PathSeparator & rf.Name
-
- If FullName = Application.PathSeparator And CLEARABSENTNETDOCS Then ' Probably absent network drive
- rf.Delete
- Else
- On Error Resume Next ' VBA raises error if file is on absent removable disk
- If Dir(FullName) = "" Then
- If (Err.Number <> 0 And CLEARABSENTREMOVABLES) Or (Err.Number = 0) Then
- rf.Delete
- End If
- Err.Clear
- End If
- On Error GoTo 0 ' Reinstate normal VBA error handling
- End If
- Next
- End Sub
-