我想将每封具有特定主题的邮件转发到电子邮件中。对于原始邮件的内容,应添加特定内容(“geprüft”)。 我现在有代码,但它无法正常工作。它发送最后一封点击的电子邮件:(。
Sub Test(oMail As MailItem) Dim MyItem As Outlook.MailItem Dim obj_curitem As MailItem Dim obj_newitem Dim obj_Selection Dim obj_curfolder Dim obj_msgitems Dim Forward As Object
If Err.Number = 0 Then
Set obj_Selection = Outlook.ActiveExplorer.Selection
If obj_Selection.Count > 0 Then
For Each obj_curitem In obj_Selection
strID = obj_curitem.EntryID
Set olNS = Application.GetNamespace("MAPI")
'Object auf einem neuen Item erstellen
Set obj_newitem = obj_curitem.Forward
With obj_curitem.Forward
.Forward = True
.SentOnBehalfOfName = "###" 'Deine Mailadresse
.Subject = "WG" & .Subject 'Betreff
.To = "###" 'Empfängermail
.BODY = "geprüft" & .BODY 'E-Mail Inhalt
.Send
End With
Next
End If End If End Sub
答案 0 :(得分:0)
这个循环适用于我:
Dim tmpMail As MailItem
For Each tmpMail In ActiveExplorer.Selection
Debug.Print tmpMail.Subject
With tmpMail.Forward
.Forward = True
.SentOnBehalfOfName = "###"
'.Subject = "WG" & .Subject 'WG is automatically added when forwarding
.To = "###"
.Body = "geprüft" & Chr(10) & .Body
.Send
End With
Next tmpMail