|
Public Sub 发邮件()
Dim n As Integer, i As Integer
Dim ws As Worksheet
Dim OutlookApp As Outlook.Application
Dim newMail As Outlook.MailItem
Set OutlookApp = New Outlook.Application
Set ws = Worksheets("sheet1")
n = ws.Range("A65536").End(xlUp).Row
For i = 2 To n
Set newMail = OutlookApp.CreateItem(olMailItem) '创建新邮件
With newMail
.Subject = "实验" '设置邮件主题
.Body = "实验数据:" & ws.Range("B" & i) '设置邮件正文
.To = ws.Range("A" & i) '设置收件人地址
.Send '开始发送
End With
Next i
Set ws = Nothing
Set newMail = Nothing
Set OutlookApp = Nothing
End Sub“
以上代码,我想把 .Body = "实验数据:" & ws.Range("B" & i) 这里的Range("B" & i)改成Range("B1:H5”)想这样的区域怎么写代码
请大神帮忙。。。。
|
|