Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub ForwardEmail(item As Outlook.MailItem)
- Dim oMail As MailItem
- On Error GoTo ErrorHandler
- If oMail.Attachments.Count > 0 Then
- If item.Class = olMail Then
- Set oMail = item.Forward
- oMail.Subject = "My New Subject" 'Can change the subject here
- oMail.HTMLBody = "Please find attached." & vbCrLf & oMail.HTMLBody
- oMail.Recipients.Add "someone@gmail.com" 'email address here
- oMail.Save
- oMail.Send
- End If
- End If
- ErrorHandler:
- Set oMail = Nothing
- End Sub
- Sub ForwardEmail(item As Outlook.MailItem)
- Dim oMail As MailItem
- On Error GoTo ErrorHandler
- If oMail.Attachments.Count > 0 Then
- If item.Class = olMail Then
- Set oMail = item.Forward
- oMail.Subject = oMail.Subject 'Can change the subject here
- oMail.HTMLBody = "Please find attached." & vbCrLf & oMail.HTMLBody
- oMail.Recipients.Add "someone@gmail.com" 'email address here
- oMail.Save
- oMail.Send
- End If
- End If
- ErrorHandler:
- Set oMail = Nothing
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement