2014-10-26 162 views
0

是否有脚本可以让我在Outlook中标记电子邮件,然后自动将它移动到文件夹?Outlook标记一封电子邮件并将其移动到一个文件夹

我发现以下内容将复制选定的电子邮件并移动它,但我需要它来标记它;

Outlook VB Macro to move selected mail item(s) to a target folder 
Sub MoveToFiled() 
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("Mailbox - Jim Merrell").Folders("@Filed") 

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 

干杯, 史蒂芬

回答

0

到底follwoing线应该做的工作:

mail.FlagRequest = "text you need" 

,或者如果你也想设置提醒等使用

Sub flag_the_mail(mail As mailitem, flagre as string, tm As String) 
On Error GoTo ende 
     mail.MarkAsTask olMarkNoDate 
     mail.FlagRequest = flagre 
    If tm <> "00:00:00 09:00" Then 
     mail.TaskStartDate = tm 
     mail.TaskDueDate = tm 
     mail.ReminderSet = True 
     mail.ReminderTime = tm 
    Else 
     mail.TaskStartDate = "01.01.4501" 
     mail.TaskDueDate = "01.01.4501" 
     mail.ReminderSet = False 
     mail.ReminderTime = "00:00:00" 
    End If 
     mail.Save 
ende: 
If Err.Number <> 0 Then MsgBox ("Fehler in 'Kennzeichensetzen': " & Err.Number & " - " & Err.Description) 
End Sub 

tm - 这是日期 - 作为一个文本在这里,例如“2014年3月11日09:00”

我希望这有助于

最大

相关问题