我设计了一个宏来转发电子邮件。以下代码草拟了一封转发电子邮件,在正文中添加了一些信息,并保留了电子邮件底部的原始内容。但唯一的问题是,当宏尝试转发电子邮件时,原始格式会丢失。
此外,默认情况下,它会将我的电子邮件ID显示为“发件人地址”。相反,它应该是“ops@ccorp.com”。你能帮我吗?
Sub Forward_Email()
Set objOL = CreateObject("Outlook.Application")
Set objMsg = objOL.ActiveInspector.CurrentItem
Set objForward = objMsg.Forward
objForward.Recipients.Add "someone@example.com"
objForward.CC = "eg1@example.com"
objOrignialBody = objForward.Body
Workbooks.Open Filename:= _
"C:\Users\desktop\Email Distribution Control File.xlsx"
Sheets("Incorrect Device Type").Select
EmailLastRow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row
Cells.Find(What:="Subject", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
ActiveCell.Offset(1, 0).Activate
BodyofEmail = ActiveCell.Value
ActiveCell.Offset(1, 0).Activate
For emailrange = 6 To EmailLastRow - 1
If ActiveCell.Row > EmailLastRow Then
GoTo DraftEmail
Else
End If
BodyofEmail = BodyofEmail & vbCrLf & ActiveCell.Value
ActiveCell.Offset(1, 0).Activate
Next emailrange
DraftEmail:
objForward.Display
objForward.Body = BodyofEmail & vbCr & vbCr & vbCr & objOrignialBody
答案 0 :(得分:0)
尝试在代码末尾添加以下代码,代表opsccorp @ com发送电子邮件:
objforward.SentOnBehalfOfName = "ops@ccorp.com"