MailItem.Move Method (Outlook)
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

MailItem.Move Method (Outlook)

Office 2010

Moves a Microsoft Outlook item to a new folder.

expression .Move(DestFldr)

expression A variable that represents a MailItem object.




Data Type





An expression that returns a Folder object. The destination folder.

Return Value

An Object value that represents the item which has been moved to the designated folder.

This Visual Basic for Applications (VBA) example uses GetDefaultFolder to return the Folder object that represents the default folder. It then uses the Find and FindNext methods to find all messages sent by Dan Wilson and uses the Move method to move all e-mail messages sent by Dan Wilson from the default Inbox folder to the Personal Mail folder. To run this example without any errors, replace 'Dan Wilson' with a vaid sender name and make sure there's a folder under Inbox called 'Personal Mail'. Note that myItem is declared as type Object so that it can represent all types of Outlook items including meeting request and task request items.

Sub MoveItems() 
 Dim myNameSpace As Outlook.NameSpace 
 Dim myInbox As Outlook.Folder 
 Dim myDestFolder As Outlook.Folder 
 Dim myItems As Outlook.Items 
 Dim myItem As Object 
 Set myNameSpace = Application.GetNamespace("MAPI") 
 Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox) 
 Set myItems = myInbox.Items 
 Set myDestFolder = myInbox.Folders("Personal Mail") 
 Set myItem = myItems.Find("[SenderName] = 'Dan Wilson'") 
 While TypeName(myItem) <> "Nothing" 
 myItem.Move myDestFolder 
 Set myItem = myItems.FindNext 
End Sub
© 2015 Microsoft