Sub Mail()
ActiveWorkbook.Save
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim Mail As Variant
Mail = MsgBox("Click OK to automatically email this workbook", vbInformation + vbOKCancel)
If Mail = vbCancel Then
Exit Sub
End If
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = Application.InputBox("Would you like to enter a message as part of the email?", "Email message", Type:=2)
With OutMail
.To = "Enter in email address"
.CC = ""
.BCC = ""
.Subject = "Enter in title" & Date
.Body = strbody
.Attachments.Add ActiveWorkbook.FullName
On Error Resume Next
.Send 'or use .Display
If Err > 0 Then MsgBox "You clicked 'No' - Therefore the email was not sent"
End With
Set OutMail = Nothing
Set OutApp = Nothing
MsgBox "Providing you clicked Yes, this email will appear in your Sent Box in Outlook"
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub