带附件的VBA电子邮件循环和CC中的不同收件人不会执行

时间:2017-05-24 13:40:00

标签: excel vba excel-vba email

逗人,

我发布此问题,因为其他邮件中的VBA代码未执行我的目的

为什么我不能将.CC添加到我的代码并执行,它会抛出错误

Sub exporttoemail2()

 Dim OutlookApp As Object
 Dim MItem As Object
 Dim cell As Range
 Dim Subj As String
 Dim EmailAddr As String
 Dim Recipient As String
 Dim Msg As String
 Dim strLocation As String


 Set OutlookApp = CreateObject("Outlook.Application")

 Set MItem = OutlookApp.CreateItem(olMailItem)

 With MItem
 .To = Range("D2") & ";" & Range("E2") & ";" & Range("F2")
 .Subject = "Hilti SOA - *Payment Notification* - " & Range("A2") & " - " & Range("B2")
 .htmlbody = "Body" 


 strLocation = Range("G2")

 .Attachments.Add (strLocation)

 .Display

 End With

End Sub

我caanot添加.CC功能顺利执行请帮助,如果我可以循环列表中的每一行也可以帮助

请参阅excel文件enter image description here

的快照

1 个答案:

答案 0 :(得分:0)

.cc应该正常工作

.cc = "YourEmail@Email.com;"

您收到了什么错误?