24 | 05 | 2017

Send Email from VBA

Code below sends a email from every VBA incarnation.

[code]

Sub SendMail()
    Dim VVOutlook As Object
    Dim VVMailItem As Object
    'Make outlook instance active
    Set VVOutlook = CreateObject("Outlook.Application")
    Set VVMailItem = VVOutlook.createitem(0)
    VVMailItem.Recipients.Add "This email address is being protected from spambots. You need JavaScript enabled to view it."
    ' Set the email subject
    VVMailItem.Subject = "Test Send using VBA"
    ' Set the email body
    VVMailItem.body = "This is the body in the text"
    ' And send it!
    VVMailItem.send
    ' Close Outlook instance
    Set VVOutlook = Nothing
End Sub
[code]
Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2258950
Latest Articles