Outlook计数电子邮件标记为“重要" [英] Outlook Count Emails mark as Important
本文介绍了Outlook计数电子邮件标记为“重要"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以指出我在这里想念的东西吗?每当我运行此命令时,它都说需要一个对象.
Can someone point out what I am missing here. Every time I run this it says that an object is required.
很抱歉,我觉得这很容易解决,但是一段时间以来我一直在绞尽脑汁.
I apologize I feel like this is a very easy fix but I have been wrecking my brain for a while.
基本上,我要完成的工作是计算有多少电子邮件被标记为高度重要.
Basically what I am trying to accomplish is count how many emails are mark as high importance.
再次,我觉得这是一个简单的错误,但我仍在学习.
Again I feel like this is such a simple error but I am still learning this.
Sub CheckForImportance()
Dim myNs As Outlook.NameSpace
Dim infldr As Outlook.Folder
Dim impMail As Outlook.MailItem
Dim ttlcount As Integer
Set myNs = Application.GetNamespace("MAPI")
Set infldr = myNs.GetDefaultFolder(olFolderInbox)
Set impMail = infldr.Items
Set ttlcount = 0
If impMail.Importance = olImportanceHigh Then ttlImp = ttlImp + 1
MsgBox ("count:" & ttlImp)
End Sub
推荐答案
示例将是
Option Explicit
Public Sub Example()
Dim Inbox As Outlook.folder
Set Inbox = Application.Session.GetDefaultFolder( _
olFolderInbox)
Dim Filter As String
Filter = "[Importance] = 2"
Dim Items As Outlook.Items
Set Items = Inbox.Items.Restrict(Filter)
Debug.Print Items.Count
MsgBox Items.Count & " High importance Items are in " & Inbox.Name
End Sub
这篇关于Outlook计数电子邮件标记为“重要"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文