【发布时间】:2017-07-24 20:32:25
【问题描述】:
我想从我的 Excel 电子表格中发送一封电子邮件,其中包含一条小消息到正文中,其中包含从 A 列到 G 列的最后一行范围。
我尝试将最后一行范围添加到以下代码中,但没有成功。
你能帮忙吗?
Sub Mail_LastRowRange_Outlook()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Thanks for your help" & '**I Would like to insert_
my last row range from column A to G in here**
On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "Looking for a solution"
.Body = strbody
.Attachments.Add ("C:\test.txt")
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
【问题讨论】: