Using API to Open Recycle Bin:   Return to List

Private Declare Function ShellExecute Lib "shell32.dll" _
    Alias "ShellExecuteA" (ByVal hWnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) _
    As Long

Private Const SW_SHOWNORMAL As Long = 1

Sub Main()
    Call ShowRecycleBin
End Sub

Public Function ShowRecycleBin() As Boolean
    Dim lRet As Long
' if using from a form, you can use me.hwnd instead of 0& for the first argument
    lRet = ShellExecute(0&, "Open", "explorer.exe", _
    "/root,::{645FF040-5081-101B-9F08-00AA002F954E}", 0&, _
    SW_SHOWNORMAL)
    ShowRecycleBin = lRet > 32 End Function



Note to Webmaster