|
|
|
|
|
|
Excel
|
Clear Recent Documents List
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000, 2002
|
Submitted by:
|
Justinlabenne
|
Description:
|
Clears the list of recent documents available from the Start menu
|
Discussion:
|
If you work on a shared computer and want to prevent others from trying to open some of your personal workbooks that you have buried and hidden somewhere on your network server, this code uses a simple API call to clear the listing of recently viewed documents.
|
Code:
|
instructions for use
|
Option Explicit
Private Declare Sub SHAddToRecentDocs Lib "shell32" _
(ByVal uFlags As Long, ByVal pv As Any)
Sub ClearRecentDocs()
SHAddToRecentDocs 0, CLng(0)
With Application
If .DisplayRecentFiles = False Then
Exit Sub
Else
.DisplayRecentFiles = False
On Error Resume Next
.CommandBars("Task Pane").Visible = False
On Error GoTo 0
.DisplayRecentFiles = True
End If
End With
End Sub
|
How to use:
|
- Open an Excel Workbook
- Copy the code
- Press Alt + F11 to open the Visual Basic Editor (VBE)
- Select INSERT > MODULE from the menubar
- Paste code into the right pane
- Press Alt+Q to return to Excel
- Save workbook before any other changes
|
Test the code:
|
- Go to TOOLS > MACRO > MACROS
- When the dialog appears, select {ClearRecentDocs}
- Press Run
|
Sample File:
|
KillRecentDocs.zip 7.74KB
|
Approved by mdmackillop
|
This entry has been viewed 118 times.
|
|