This code enables you to send an email, but it uses the preferred client of Microsoft outlook to actually send the email, you can send the e-mail to whoever you want but it needs to send the e-mail from an account, for this it used Outlook.
Modify the details below and add the addresses of the people you want to send the e-mail to.
I suggest setting up your outlook with the address you want to send the email from, be this, hotmail/windows live, gmail or any exchange or pop server.
Sub Mail_workbook_Outlook_1()
'This will email the last version of the active work book
'Enter email address below
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "test1@test.com; test@test2.com; 3rdemail@email.com"
.CC = ""
.BCC = ""
.Subject = "Email heading"
.Body = "body of email text"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Hope this helps,
Mike
Bookmarks