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

问题描述

我想知道是否有办法按日期对电子邮件进行排序,然后打开找到的最新电子邮件.

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.

推荐答案

您需要排序 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

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

09-05 07:15
查看更多