excel vba发送邮件问题
我想用vba发送邮件Subsonic()OnErrorResumeNextDimrowCount,endRowNoSetobjOutlook=CreateObject("...
我想用vba发送邮件
Sub sonic()
On Error Resume Next
Dim rowCount, endRowNo
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.createltem(olMailitem)
endRowNo = Cells(1, 1).CurrentRegion.Rows.Count
For rowCount = 2 To endRowNo
Set objMail = objOutlook.CreateItem(olMailitem)
With objMail
.To = "sheet1!A2"
.Subject = "sheet1!B2"
.Body = "sheet1!C2"
.Attachments.Add Cells(rowCount, 4).Value
.CC = "sheet1!E2"
.BCC = "sheet1!F2"
.Send
End With
Set objMail = Nothing
Next
End Sub
但是做到这一步的时候
To = "sheet1!A2"
.Subject = "sheet1!B2"
.Body = "sheet1!C2"
.Attachments.Add Cells(rowCount, 4).Value
.CC = "sheet1!E2"
.BCC = "sheet1!F2"
赋值总弄不上去,该怎么弄啊! 展开
Sub sonic()
On Error Resume Next
Dim rowCount, endRowNo
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.createltem(olMailitem)
endRowNo = Cells(1, 1).CurrentRegion.Rows.Count
For rowCount = 2 To endRowNo
Set objMail = objOutlook.CreateItem(olMailitem)
With objMail
.To = "sheet1!A2"
.Subject = "sheet1!B2"
.Body = "sheet1!C2"
.Attachments.Add Cells(rowCount, 4).Value
.CC = "sheet1!E2"
.BCC = "sheet1!F2"
.Send
End With
Set objMail = Nothing
Next
End Sub
但是做到这一步的时候
To = "sheet1!A2"
.Subject = "sheet1!B2"
.Body = "sheet1!C2"
.Attachments.Add Cells(rowCount, 4).Value
.CC = "sheet1!E2"
.BCC = "sheet1!F2"
赋值总弄不上去,该怎么弄啊! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询