我正在尝试修改宏以保存今天到达的电子邮件中的所有附件 . 问题是我不知道如何在Outlook VBA中引用电子邮件对象的日期属性 .
我怎么能这样做,更重要的是我怎样才能找到下次自己引用物体的方法?我没有找到很多关于outlook对象模型的参考资料 .
我现有的代码如下:
Sub GetAllAttachments() 'Exports and saves all attachements in the inbox
Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Today = Format(Now(), "yyyy MM dd")
Set ns = GetNamespace("MAPI")
Set Inbox = ns.Folders("Secondary")
Set Inbox = Inbox.Folders("Inbox")
i = 0
If Inbox.Items.Count = 0 Then
MsgBox "There are no messages in the Inbox.", vbInformation, _
"Nothing Found"
Exit Sub
End If
For Each Item In Inbox.Items
If EMAIL_DATE = Today Then
For Each Atmt In Item.Attachments
FileName = "C:\Email Attachments\" & Atmt.FileName
Atmt.SaveAsFile FileName
i = i + 1
End If
Next Atmt
Next Item
End Sub
1 回答
项目没有日期属性 .
尝试使用
例如:
您需要从当时剥离日期 .