Code to move selected mail item

  • Thread starter Thread starter Evan
  • Start date Start date
E

Evan

I would like to have a procedure to run from a toolbar button that will
simply move the selected message to the "Temp" folder, which is a sub folder
of inbox.

Thank for any help
 
Map this macro to your custom toolbar button:

Sub MoveSelectedMessageToTempFolderUnderInbox()
Dim objNS As Outlook.NameSpace
Dim objItem As Object
Dim objInbox As Outlook.MAPIFolder, objSubFolder As Outlook.MAPIFolder

Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objSubFolder = objInbox.Folders("Temp")
Set objItem = ActiveExplorer.Selection.Item(1)
objItem.Move objSubFolder
End Sub
 
Back
Top