E-Mailing from excel
hey this is a piece from my refereence file
it should work pretty well.
it should all be pretty straight forward to taylor to your needs.
Code:
Sub Mail_small_Text_Outlook()
'Working in Office 2000-2010
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Hi there" & vbNewLine & vbNewLine & _
"Cell A1 is changed" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
On Error Resume Next
With OutMail
.To = Email@Domain.com 'Email Address (can be a cell reference)
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = strbody
'.Attachments.Add ("C:\test.txt") 'You can add a file like this
.Display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
any problems give me a shout =D
Bookmarks