We help IT Professionals succeed at work.

macro or keyboard shortcut in outlook 2007

Medium Priority
723 Views
Last Modified: 2012-05-06
I'm looking for a way to map a key on my keyboard to automatically move whatever email I am viewing to a specific folder.
Comment
Watch Question

You have to write a macro, assign a button on the toolbar, and then assign a shortcut to the button.
 
 For instance, to send the currently open email to the folder, create the macro:
 
 
 Sub MoveOpenMail()
     Dim oc As Object
     Dim myolApp As Outlook.Application
     Dim myNamespace  As Outlook.NameSpace
     Dim InboxFolder As MAPIFolder
     Dim DoneFolder As MAPIFolder
     Set myolApp = CreateObject("Outlook.Application")
     Set myNamespace = myolApp.GetNamespace("MAPI")
     Set InboxFolder = myNamespace.GetDefaultFolder(olFolderInbox)
     Set MoveToFolder = InboxFolder.Folders("FOLDERNAME")
     Set oc = Application.ActiveInspector.CurrentItem
 
     Select Case oc.Class
         Case olMail
             Set objMailItem = oc
             objMailItem.Move MoveToFolder
     End Select
 End Sub
 
 The code checks that the item is in fact a Mail item, and does not work for the currently selected item, but the currently open item.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Alternativy follow: http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_24013716.html to create the macro, then assign a button on the toolbar, and then assign a shortcut to the button.

Ste
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.