Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving email from inbox to specific folder 1

Status
Not open for further replies.

DJRobbieBAtl

Technical User
Jun 17, 2004
5
US
I would like to create a keystroke, for example ctrl-m, to move an email from my inbox to a specific folder. I tried searching the FAQ but got a message that the search feature was not working. Anyone have any suggestions? I am using Outlook with Office XP. I do have a little background with VBA in case there is some code.

Thanks in advance!
DJRobbieB


 
Hi DJRobbieB,

I think you will need code for this.

I'm just trying to learn Outlook and I find one of the best ways to learn is to tackle a real problem. The following works for me (but would benefit from error checking) but may not be the best way to do it.

Code:
[blue]Sub MoveMyItem()

Dim objDestFolder As MAPIFolder
Dim objMailItem As MailItem

Set objDestFolder = Application.GetNamespace("MAPI").Folders(1).Folders("[i]YourFolder[/i]")

For Each objMailItem In Application.ActiveExplorer.Selection
    objMailItem.Move objDestFolder
Next

End Sub[/blue]

I don't know if it's possible to assign a hotkey directly to a macro in Outlook, but you can do it indirectly by setting up a toolbar button with an accelerator key.

Close the VBE
Select Tools > Customize, Commands tab
Select Macros from the left hand list and the above macro from the rigt hand list
Click and Drag to a toolbar
Right click on resulting icon and change to text only
Then change the text to &Y (that's what I used - you can choose your own character)

Pressing Alt+Y then ran the macro and moved my selected items.

As I said, I'm a beginner. With luck, an expert will appear and put us both right.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
Hello Tony!

Thank you so much for the response... it worked PERFECTLY!!


Star for you!


Thanks again,
DJRobbieB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top