Send E-Mail

This code allows excel to send an email to a set address (or it could be sent to a variable address created by code earlier on) and it attaches the excel workbook as well.

Sub Open_Outlook_And_Attach (ByVal sFileName As String) Dim oOL As Outlook.Application Dim oItem As Outlook.MailItem Set oOL = New Outlook.Application Set oItem = oOL.CreateItem(olMailItem) oItem.Subject = "Mail from Jim" oItem.To = "jim@someone.com" oItem.Attachments.Add sFileName oItem.Body = "Something" oItem.Send Set oItem = Nothing Set oOL = Nothing End Sub

Code Snippits