SHARE
TWEET

Untitled

a guest Jun 17th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub ForwardEmail(item As Outlook.MailItem)
  2.  Dim oMail As MailItem
  3.  
  4.  On Error GoTo ErrorHandler
  5.  If oMail.Attachments.Count > 0 Then
  6.  If item.Class = olMail Then
  7.  Set oMail = item.Forward
  8.  oMail.Subject = "My New Subject" 'Can change the subject here
  9.  oMail.HTMLBody = "Please find attached." & vbCrLf & oMail.HTMLBody
  10.  oMail.Recipients.Add "someone@gmail.com" 'email address here
  11.  
  12.  oMail.Save
  13.  oMail.Send
  14.  End If
  15.  End If
  16.  ErrorHandler:
  17.  Set oMail = Nothing
  18.  End Sub
  19.      
  20. Sub ForwardEmail(item As Outlook.MailItem)
  21.   Dim oMail As MailItem    
  22.  
  23.   On Error GoTo ErrorHandler
  24.   If oMail.Attachments.Count > 0 Then
  25.    If item.Class = olMail Then
  26.      Set oMail = item.Forward
  27.      oMail.Subject = oMail.Subject 'Can change the subject here
  28.      oMail.HTMLBody = "Please find attached." & vbCrLf & oMail.HTMLBody
  29.      oMail.Recipients.Add "someone@gmail.com" 'email address here
  30.  
  31.      oMail.Save
  32.      oMail.Send
  33.   End If
  34.  End If
  35.  ErrorHandler:
  36.   Set oMail = Nothing
  37. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top