×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Spam Protection

Adding a Empty Junk E-Mail Button to Outlook by markdmac
Posted: 13 Nov 06 (Edited 24 Dec 08)

I thought others might like to use this same solution that I did for Junk E-mail.  I got tired of right clicking the Junk E-mail folder and having to choose Empty Junk Email Folder.  So I created a button to do it.  Junk Email is a big problem for me at home and this simplifies the task of cleaning out the Junk.  Many thanks to KC Lemson and his blog for leading the way on this and providing the needed macro code.

Create a Certificate
First you will want to create your own digital certificate so you don't get prompted all the time to use the macro.  Search your hard drive for a file called selfcert.exe.  On my system it is located at C:\Program Files\Microsoft Office\OFFICE12.  Run it and provide your name in the box and click OK.

Create the Macro
1.    Start Outlook
2.    Tools | Macros | Security
3.    Choose "Medium", which will prompt you on whether or not you want to run macros (VBA). You may need to restart Outlook at this point in order for that setting to take effect.
4.    Tools | Macros | Visual Basic Editor
5.    Doubleclick on This Outlook Session on the left, which will open the code window on the right
6.    In the code window, paste the code

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
7.    Tools | Digital Signature
8.    Click Choose, Select your signature and click OK
9.    Click OK
10.    Save the Macro

You can also use the following alternate macro code that will let you empty the junk mail and empty deleted items all in one shot.

CODE

Public Sub EmptyJunkEmailAndDeletedFolder()
       Dim outapp As Outlook.Application
       Set outapp = CreateObject("outlook.application")
       Dim olitem As Object
       Dim fldJunk As Outlook.MAPIFolder
       Dim fldDeleted As Outlook.MAPIFolder
                                   
       Set fldJunk = outapp.GetNamespace("MAPI").GetDefaultFolder(olFolderJunk)
       For Each olitem In fldJunk.Items
           olitem.Delete
       Next
       Set fldDeleted = outapp.GetNamespace("MAPI").GetDefaultFolder(olFolderDeletedItems)
       For Each olitem In fldDeleted.Items
           olitem.Delete
       Next
       Set fldJunk = Nothing
       Set fldDeleted = Nothing
       Set olitem = Nothing
       Set outapp = Nothing
End Sub

Create an Icon to the Macro
1.    View | Toolbars | Customize
2.    On the Commands tab, click Macros on the left-hand side
3.    Drag the appropriate macro to the standard toolbar (say, next to the "Send/Receive" button)
4.    Right click on the button and change the Name field if you want to shorten the text or assign a different accelerator key
5.    Click Close

Changing to a Custom Icon Image

Option 1: Use one of the default custom buttons
1. Right click on the toolbar and choose Customize
2. Right click on the button whose icon you want to change
3. Click on Change Button Image and select one of those options

Option 2: Copy an icon from a different button
1. Go to the folder with the toolbar whose icon you want to copy
2. Right click on that button and choose Customize
3. Right click on that button again and choose Copy Button Image
4. Go to the folder with your custom button
5. Right click on that button and choose Customize
6. Right click on that button and choose Paste Button Image

Option 3: Create your own icon with an icon editor
1. Right click on the button whose icon you want to change and choose Customize
2. Right click on that button again and choose Edit Button Image

The first time you click the new button you will be prompted to either select a certificate or always allow macros from the publisher.  Choose to always allow the current publisher (that's you).  Note that this self signed certificate is only good on the machine it was signed on.
 

Back to Microsoft: Exchange FAQ Index
Back to Microsoft: Exchange Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close