獲取OutLook郵件主題和接收時間


Sub Getoutlook()
Dim ol As Object, dates As Date, t%, i%
i = sheet5.Range("b65536").End(xlUp).Row
Set ol = CreateObject("outlook.application") '后期綁定
For Each r In ol.getnamespace("MAPI").getdefaultfolder(6).Folders("APPLY").items '遍歷收件箱中子文件夾為"APPLY"中的郵件
If r.unread Then '如果郵件狀態為未讀
dates = Format(r.creationtime, "yyyy/m/d") '對接收時間格式化
If InStr(r.Subject, "答復") = False Then '對主題設置過濾條件
r.unread = False
t = t + 1
sheet5.Cells(i + t, "b") = r.Subject '獲取主題
sheet5.Cells(i + t, "g") = r.creationtime '獲取接收時間
End If
End If
End If
Next
If t = 0 Then
MsgBox "無符合條件的數據"
Else
MsgBox "提取完畢"
End If
Set ol = Nothing
End Sub


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM