Gmail has popularised archive as an easy way to keep your inbox clean without trashing email, but if you're using Outlook, archive isn't really an option—by default, at least. However you like to keep your inbox clean, one of the most time-consuming and annoying tasks in Outlook is moving your mail to an archive folder—and today we'll show you how to automate it using Outlook's powerful macro support.
All credit for this solution goes to Lifehacker reader jayp, who sent in his own ubergeeky technique that was the basis for this article—well worth a read if you want to see a more advanced version of the script .
For our scenario, we're trying to create a button that moves email messages from the Inbox into an Archive folder like this one—the magic happens behind the scenes with a macro that we'll create.
In order to use macros without being prompted every single time to accept them, you need to create a personal digital certificate using the aptly named Digital Certificate for VBA Projects utility.
Creating a digital certificate couldn't be easier—just type in a name and click the button, closing it out when you are done.
Next we'll create the macro by selecting Tools -> Macro -> Macros from the menu, type in a name for your macro and click the Create button.
<img src="http://cache.gawkerassets.com/assets/images/lifehacker/2009/03/image14.png" alt=""
/>Once you've launched the Visual Basic editor, you'll need to paste in the following macro, replacing whatever is currently there. You'll notice the
Folders("Archive") section in the code—this can be modified if you want to use a folder name other than Archive.
Set ArchiveFolder = Application.GetNamespace("MAPI"). _
For Each Msg In ActiveExplorer.Selection
Once you've completed that step, go to Tools -> Digital Signature and assign the certificate that you created earlier. This is what will allow Outlook to run our macro without constant warnings. Once you are finished, click the save button and use the File -> Close and Return menu item to return to Outlook.
Next we get to actually add the button to the toolbar—just right-click over the toolbars, choose Customise, and then browse down to Commands -> Macros and drag your macro onto the toolbar.
While you still have the Customise dialog open, you can rename the button or even eliminate the text, and assign a new icon. If you want to create a shortcut key for the button, you can put an ampersand (&) character before any of the letters, which will make the shortcut accessible through the Alt+<key> shortcut key combination.
Now we've got an icon to archive mail—but you'll need to restart Outlook to complete the setup.
After Outlook starts back up, you'll see a security notice dialog asking whether to enable or disable macros—you want to choose "Trust all documents from this publisher" so you won't be prompted again.
At this point you should have a fully working solution for quickly archiving messages, but the same techniques could be used to create more advanced functionality—like a full-blown GTD system—it's just a matter of rolling up your geek sleeves and getting to work.