我正在使用excel VBA工作发送Outlook电子邮件的宏。我已经迈出了向不同收件人发送电子邮件的第一步。我的代码:
Sub SetRecipients()
Dim aOutlook As Object
Dim aEmail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String
Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)
Set rngeAddresses = ActiveSheet.Range("A3:A13")
For Each rngeCell In rngeAddresses.Cells
strRecipients = strRecipients & ";" & rngeCell.Value
Next
aEmail.Importance = 2
aEmail.Subject = "Indicator activity warning ( TestMailSend )"
aEmail.Body = "Hi"
'aEmail.ATTACHMENTS.Add ActiveWorkbook.Book2.xlsx
aEmail.To = strRecipients
aEmail.Send
End Sub
我的目标:是能够设置多个不同日期,以便自动发送此电子邮件。
问题:我不确定这是如何运作的
答案 0 :(得分:0)
您似乎对Outlook项目(MailItem)的DeferredDeliveryTime属性感兴趣。它允许设置DateTime,指示邮件传递的日期和时间。
您可能会发现How to automate Outlook from another program文章很有帮助。