Hi there, I have having difficulties getting this macro to work. It keeps giving me a debug error 91. I need it to email a range of cells (which are a constant) using my secondary email. It is under the same account. I have identified it as account (2).
Sub CDO_Send_Selection_Or_Range_Body()
Application.ScreenUpdating = False
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
' Select the range of cells on the active worksheet.
Sheets("Email - 30 Min").Select
ActiveSheet.Range("A1:H29").Select
' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = "test@test.com"
.Item.Subject = "Daily Service Level Update - " & Now()
.SendUsingAccount = OutApp.Session.Accounts.Item(2)
.Item.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
Application.Quit
End Sub
Bookmarks