1
我有一個前景宏讀取所有未讀電子郵件的主題行。展望VBA日期時間過濾器
Sub ReadMails()
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set objFolderSrc = objFolder.Folders("My Own Folder")
Dim Subjects() As String
ReDim Subjects(1 To 1) As String
Set colItems = objFolderSrc.Items
Set colFilteredItems = colItems.Restrict("[UnRead] = False")
For Each objMessage In colFilteredItems
Subjects(UBound(Subjects)) = objMessage.ConversationTopic
ReDim Preserve Subjects(1 To UBound(Subjects) + 1) As String
Next
End Sub
取而代之,我需要讀取當天早上到上午8點之間在當天早上發送的電子郵件。
如何添加過濾器
什麼是'olFolderInbox'? – Vityata
@Vityata它是收到所有電子郵件的文件夾。這是根收件箱文件夾不要擔心。所有的作品 –
嗯,我只是想複製你已有的東西,並從那裏繼續。一般來看看這裏:https://msdn.microsoft.com/en-us/library/office/ff869597.aspx特別是這行:'sFilter =「[LastModificationTime]>'」&Format(「1/15/99 3:30 pm「,」ddddd h:nn AMPM「)&」'「' – Vityata