我正在尝试建立一个宏,该宏可从excel复制特定单元格并以源格式将其粘贴到新电子邮件的正文中,但是我会遇到运行时错误或正文显示为“ -1”。 / p>
试图将正文更改为activesheet.Range(“ A1:C186”)。select,但这会在电子邮件正文中创建“ -1”。如果我将正文保留为Range(“ A1:C186”),则会出现运行时错误'440':该对象不支持此方法。
Dim myToAdd As String
Dim Group As Range
Set Group = Range("B11")
If Group = "Group1" Then
myToAdd = "matt@email.com:"
ElseIf Group = "Group2" Then
myToAdd = "matt2@email.com:"
ElseIf Group = "Group3" Then
myToAdd = "matt3@email.com;" & " " & "matt4@email.com:"
Else
End If
With CreateObject("Outlook.Application").createitem(0) '0 will create a new email item
.To = myToAdd
.Subject = Range("B7") & " - " & Range("B8")
.Body = Range("A1:C186")
.Display
End With
电子邮件正文范围应将单元格粘贴到新创建的正文中。希望应该粘贴并“保留源格式”。