我创建了这个宏来通过outlook自动发送邮件!我的宏运行,但有一个问题。它不是仅在邮件内容中发送我要求的偏移值,而是发送整个工作表。我提供以下代码:
Dim ToArray As String
Dim CCArray As String
Dim Subject As String
Dim Content As String
Dim cell3 As Range
For Each cell3 In ws1.Range("D2:D" & lastrow1)
ToArray = cell3.Offset(0, 16).Value
CCArray = cell3.Offset(0, 17).Value
Subject = cell3.Offset(0, 18).Value
Content = cell3.Offset(0, 19).Value
ActiveWorkbook.EnvelopeVisible = True
With ws1.MailEnvelope
.Introduction = Content
.Item.To = ToArray
.Item.CC = CCArray
.Item.Subject = Subject
.Item.Send
End With
Application.DisplayAlerts = False
Next cell3
答案 0 :(得分:0)
我认为你应该尝试使用它:
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.CreateItem(0)
With Mail_Single
.Subject = Subject
.To = "email@address.com"
.cc = "email@address.com"
.BCC = "email@address.com"
.SentOnBehalfOfName = "email@address.com"
.HTMLBody = Content
.send
End With
希望有帮助...