Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. Private Sub CommandButton1_Click()
  2.  
  3. UserForm1.hide
  4. Dim objMsg As MailItem
  5.  
  6. Set objMsg = Application.CreateItem(olMailItem)
  7.  
  8. With objMsg
  9. .SentOnBehalfOfName = """SenderName"" <Reply@Address.com>"
  10. .To = "Alias@domain.com"
  11. .CC = "Alias2@domain.com"
  12. .BCC = "Alias3@domain.com"
  13. .Subject = "This is the subject"
  14. 'Set body format to HTML
  15. .BodyFormat = olFormatHTML
  16. .HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY>Type the message text here. </BODY></HTML>"
  17. '.Attachments.Add ("path-to-file.docx")
  18.  
  19. ' Calculate a date using DateAdd or enter an explicit date
  20. .ExpiryTime = DateAdd("m", 6, Now) '6 months from now
  21. .DeferredDeliveryTime = #8/1/2012 6:00:00 PM#
  22. .Display
  23. End With
  24.  
  25. Set objMsg = Nothing
  26.  
  27. UserForm1.Show
  28.  
  29. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement