Hi,
Pick this code up for sending an email from Excel, what i would like to do is add a reference from the active workbook, either in the body or probably preferably in the Subject line, how can i modify the below to do this.
My Cell is C55
Thanks
Pick this code up for sending an email from Excel, what i would like to do is add a reference from the active workbook, either in the body or probably preferably in the Subject line, how can i modify the below to do this.
My Cell is C55
Thanks
Rich (BB 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 & _
"Valnet Ref" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
On Error Resume Next
With OutMail
.To = "email@email.com"
.CC = ""
.BCC = ""
.Subject = "Sucessful Submission"
.Body = strbody
'You can add a file 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