我设计了一个宏来转发电子邮件。下面的代码草拟了一封转发电子邮件,在正文中添加了一些信息,在电子邮件底部保留了原始内容。但唯一的问题是,当宏尝试转发电子邮件时,原始格式会丢失。
此外,默认情况下,它将我的电子邮件 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