Jan 18, 2013

快捷键移动Outlook邮件到指定目录

成天收到几百封Email的情况首先当然是要设置rules进行分类处理了。

但如果分类处理后还是会有些重要邮箱会直接到达Inbox。这时,看完邮件后用快捷键自动分类到指定邮箱的macro功能就很有效率。

各位可以把下面的代码添加后,再放到Quick Access Toolbar上,然后就可以用Alt+1,2,3等来进行快捷键操作了。

还是会有些重要邮箱会直接到达Inbox。这时,看完邮件后用快捷键自动分类到指定邮箱的macro功能就很有效率。各位可以把下面的代码添加后,再放到Quick Access Toolbar上,然后就可以用Alt+1,2,3等来进行快捷键操作了。


'Outlook VB Macro to move selected mail item(s) to a target folder
Sub MoveToReports()
On Error Resume Next
Dim ns As Outlook.NameSpace
Dim moveToFolder As Outlook.MAPIFolder
Dim objItem As Outlook.MailItem
Set ns = Application.GetNamespace("MAPI")
'Define path to the target folder
Set moveToFolder = ns.Folders("你的邮箱名").Folders("Inbox").Folders("需要转移到的子目录名")
If Application.ActiveExplorer.Selection.Count = 0 Then
MsgBox ("No item selected")
Exit Sub
End If
If moveToFolder Is Nothing Then
MsgBox "Target folder not found!", vbOKOnly + vbExclamation, "Move Macro Error"
End If
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
Set objItem = Nothing
Set moveToFolder = Nothing
Set ns = Nothing
End Sub

Post by SUN @ 10:22 am | 与时俱进 | Comments (2) | Add to del.icio.us | Digg This!
  • At 2013.02.01 23:44, QQ said:

    两年来第一篇吗?笔耕不辍啊老公!

    [Reply]      

  • At 2015.06.26 14:22, QQ said:

    踩踩~

    [Reply]      

(Required)
(Required, will not be published)