How to add a toolbar button & hotkey to empty the junk e-mail folder in Outlook 2003


I saw this discussion on Jonathan’s blog, so here’s one option:


#1: Follow the instructions in this article with this code:



Public Sub EmptyJunkEmailFolder()


    Dim outapp As Outlook.Application
    Set outapp = CreateObject(“outlook.application”)
    Dim olitem As Object
    Dim fldJunk As Outlook.MAPIFolder
   
    Set fldJunk = outapp.GetNamespace(“MAPI”).GetDefaultFolder(olFolderJunk)
    For Each olitem In fldJunk.Items
        olitem.Delete
    Next
   
    Set fldJunk = Nothing
    Set olitem = Nothing
    Set outapp = Nothing


End Sub


#2: Assign the above macro to a toolbar button as per the instructions in this article
#3: Change the icon for the macro as per the instructions in this article (stealing the icon from Tools | Empty Deleted Items for example)

Comments (0)