如何创建脚本以将收件箱中当前处于活动状态的电子邮件移动到Outlook 2007中的另一个文件夹 [英] How can I create a script to move the currently active email in the Inbox to another folder in Outlook 2007

查看:91
本文介绍了如何创建脚本以将收件箱中当前处于活动状态的电子邮件移动到Outlook 2007中的另一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我会收到我想保留的电子邮件,但是将其移动到适当的文件夹中可能会很痛苦.我该如何执行一个脚本,该脚本会将正在查看的电子邮件(例如使用C-S-v)移动到某个名为缓冲区"的文件夹中?

I sometimes get emails that I want to keep but to move them into the appropriate folder can be a pain. How can I execute a script that will move (like using C-S-v) the email I'm looking at into a certain folder called "buffer", for instance?

我正在使用Outlook 2007.

I'm using Outlook 2007.

谢谢.

没有任何标准可以创建来自动执行此过程,例如通过规则.这只是我凝视它时所做的判断.

there isn't any criteria that can be created to automate this process like through a rule. it is merely a judgment call I make as i'm staring at it.

推荐答案

这是我正在使用的代码.

Here's the code I'm using.

Sub MoveSelectedMessagesToFolder()
'Originally written by Chewy Chong
'Taken from http://verychewy.com/archive/2006/04/12/outlook-macro-to-move-an-email-to-folder.aspx
'Thanks Chewy!
'Ken
On Error Resume Next
    Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
    Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem

    Set objNS = Application.GetNamespace("MAPI")
    Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
    'For the "Item" portion, I used the name of the folder exactly as it appear in the ToolTip when I hover over it.
    Set objFolder = objNS.Folders.Item("Personal Folders").Folders.Item("Buffer")

'Assume this is a mail folder

    If objFolder Is Nothing Then
        MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER"
    End If

    If Application.ActiveExplorer.Selection.Count = 0 Then
        'Require that this procedure be called only when a message is selected
        Exit Sub
    End If
    For Each objItem In Application.ActiveExplorer.Selection
        If objFolder.DefaultItemType = olMailItem Then
            If objItem.Class = olMail Then
                objItem.Move objFolder
            End If
        End If
    Next

这篇关于如何创建脚本以将收件箱中当前处于活动状态的电子邮件移动到Outlook 2007中的另一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆