VBA Send an email

Sending an email using VBA.

It is imperative that you are using Excel 2010 or newer on a Windows PC, and also use Outlook as your email software for this to work.



Sub Send_email
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = ""
On Error Resume Next
With OutMail
.To = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "Just enquiring..."
.Body = strbody
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub






Contact us for some advice and guidance on how your Excel development could be created and start helping your business straight away. Contact Us

Datanology