Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub CommandButton1_Click()
- UserForm1.hide
- Dim objMsg As MailItem
- Set objMsg = Application.CreateItem(olMailItem)
- With objMsg
- .SentOnBehalfOfName = """SenderName"" <Reply@Address.com>"
- .To = "Alias@domain.com"
- .CC = "Alias2@domain.com"
- .BCC = "Alias3@domain.com"
- .Subject = "This is the subject"
- 'Set body format to HTML
- .BodyFormat = olFormatHTML
- .HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY>Type the message text here. </BODY></HTML>"
- '.Attachments.Add ("path-to-file.docx")
- ' Calculate a date using DateAdd or enter an explicit date
- .ExpiryTime = DateAdd("m", 6, Now) '6 months from now
- .DeferredDeliveryTime = #8/1/2012 6:00:00 PM#
- .Display
- End With
- Set objMsg = Nothing
- UserForm1.Show
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement