Created
July 4, 2016 15:38
-
-
Save fo40225/c00a65da2584bff78bbdc1f78022f52f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub MoveMail() | |
On Error Resume Next | |
Dim ns As Outlook.NameSpace | |
Dim moveToFolder As Outlook.MAPIFolder | |
Dim objItem As Outlook.MailItem | |
ns = Application.GetNamespace("MAPI") | |
moveToFolder = ns.Folders("資料檔名稱").Folders("資料夾名稱") | |
For Each objItem In Application.ActiveExplorer.Selection | |
If moveToFolder.DefaultItemType = olMailItem Then | |
If objItem.Class = olMail Then | |
objItem.Move(moveToFolder) | |
End If | |
End If | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment