Clearing the Documents List (under the Start button):   Return to List

Option Explicit

Private Declare Sub SHAddToRecentDocs Lib "shell32.dll" _
    (ByVal uFlags As Long, ByVal PV As String)

Sub Main()
Dim MyResult As Boolean
    MyResult = ClearDocumentsMenu()
    If MyResult = True Then
        MsgBox "Documents removed."
    Else
        MsgBox "Documents not removed."
    End If
End Sub

Public Function ClearDocumentsMenu() As Boolean
    ' Returns true if successful, false otherwise
    SHAddToRecentDocs 2, vbNullString
    ClearDocumentsMenu = Err.LastDllError = 0
End Function



Note to Webmaster