如何按日期排序电子邮件并打开发现的最新电子邮件? [英] How to sort emails by date and open the latest email found?

查看:227
本文介绍了如何按日期排序电子邮件并打开发现的最新电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有方法按日期排序电子邮件,然后打开发现的最新电子邮件。

I'm wondering if there is a way to sort emails by date and then open the latest email found.

我正在搜索有身体内的独特标签。为了避免重复的电子邮件具有相同的标签,我必须按日期排序这些电子邮件,并打开发现的最新电子邮件,以便我可以回复。

I'm trying to search for emails that has a unique tag inside the Body. In order to avoid duplicate emails that have the same tag, I have to sort these emails by date and open the latest email found so that I can reply to it.

推荐答案

您需要电子邮件ff867228(v = office.15).aspxrel =nofollow noreferrer> ReceivedTime 属性,返回指示收到项目的日期和时间的日期。

You need to Sort emails on the ReceivedTime property which returns a Date indicating the date and time at which the item was received.

 Sub SortByDate() 
  Dim myNameSpace As Outlook.NameSpace 
  Dim myFolder As Outlook.Folder 
  Dim myItem As Outlook.MailItem 
  Dim myItems As Outlook.Items 

  Set myNameSpace = Application.GetNamespace("MAPI") 
  Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox) 
  Set myItems = myFolder.Items 
  myItems.Sort "[ReceivedTime]"
  For Each myItem In myItems 
   MsgBox myItem.Subject & " ---- " & myItem.ReceivedTime
  Next myItem 
 End Sub

这篇关于如何按日期排序电子邮件并打开发现的最新电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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