Hello All
i want to forward selected mail as attachment with the same mail subject of mail.
in body mail
Hello Team
please find attached for your ready work.
To, XXX@yahoo.com;zzz@Eileen.com
below is pic what i am trying to do, right now i am doing all this manually
Adeel
Forward Mail In attachment with VBA
-
- 3StarLounger
- Posts: 264
- Joined: 04 Oct 2017, 15:47
Forward Mail In attachment with VBA
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 79317
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Forward Mail In attachment with VBA
Does this do what you want?
Code: Select all
Sub ForwardAsAttachment()
Dim objItem As Object
Dim objMsg As MailItem
Select Case TypeName(Application.ActiveWindow)
Case "Explorer"
Set objItem = Application.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set objItem = Application.ActiveInspector.CurrentItem
Case Else
Beep
Exit Sub
End Select
Set objMsg = Application.CreateItem(olMailItem)
With objMsg
.Attachments.Add objItem, olEmbeddeditem
.Subject = objItem.Subject
.Body = "Hello Team" & vbCrLf & "Please find attached for your ready work."
.To = "emailaddress1;emailaddress2"
.Display ' or .Send if you want to send immediately
End With
End Sub
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 264
- Joined: 04 Oct 2017, 15:47
Re: Forward Mail In attachment with VBA
Prefect sir,
this is exactly what I want, Much Much thnx
Adeel
this is exactly what I want, Much Much thnx
Adeel