How to send / email range of cells through outlook from Excel?
Have you ever suffered with a problem that after finishing a report in a worksheet, and you need to send to a range of cells in this worksheet which contain some important data to your specific recipient. Are there any quick ways for you to email this range from Excel without opening Outlook?
Send range of cells as attachment from Excel with VBA code
Send range of cells as body from Excel with VBA code
Send range of cells as attachment from Excel with VBA code
The following VBA code can help you to send your selected range as attachment in Excel. Please do as this:
1. Open your workbook and then hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: send range of cells as attachment from Excel
Sub SendRange()
'Update 20131209
Dim xFile As String
Dim xFormat As Long
Dim Wb As Workbook
Dim Wb2 As Workbook
Dim Ws As Worksheet
Dim FilePath As String
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
Dim WorkRng As Range
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set Wb = Application.ActiveWorkbook
Wb.Worksheets.Add
Set Ws = Application.ActiveSheet
WorkRng.Copy Ws.Cells(1, 1)
Ws.Copy
Set Wb2 = Application.ActiveWorkbook
Select Case Wb.FileFormat
Case xlOpenXMLWorkbook:
xFile = ".xlsx"
xFormat = xlOpenXMLWorkbook
Case xlOpenXMLWorkbookMacroEnabled:
If Wb2.HasVBProject Then
xFile = ".xlsm"
xFormat = xlOpenXMLWorkbookMacroEnabled
Else
xFile = ".xlsx"
xFormat = xlOpenXMLWorkbook
End If
Case Excel8:
xFile = ".xls"
xFormat = Excel8
Case xlExcel12:
xFile = ".xlsb"
xFormat = xlExcel12
End Select
FilePath = Environ$("temp") & "\"
FileName = Wb.Name & Format(Now, "dd-mmm-yy h-mm-ss")
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
Wb2.SaveAs FilePath & FileName & xFile, FileFormat:=xFormat
With OutlookMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "information of kte"
.Body = "hello, please check and read this document. "
.Attachments.Add Wb2.FullName
.Send
End With
Wb2.Close
Kill FilePath & FileName & xFile
Set OutlookMail = Nothing
Set OutlookApp = Nothing
Ws.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Note: In the above code, you can change the following information to your own need.
- .To = ""
- .CC = ""
- .BCC = ""
- .Subject = "information of kte"
- .Body = "hello, please check and read this document."
3. Then click F5 key to run this code, and a prompt box will pop out to remind you selecting a range that you want to send. See screenshot:
4. Then click OK, and a prompt box will appear, after the progress bar finishing, click Allow, and then the specific range of cells has been sent to your recipient as an attachment.
Send range of cells as body from Excel with VBA code
If you want to send a specific range as part of message body from Excel, you can also apply the following VBA code to solve it.
Kutools for Excel, with more than 120 handy functions, makes your jobs easier. | ||
1. Activate your worksheet and hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: send range of cells as body from Excel
Sub EmailRange()
'Update 20131209
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Application.ScreenUpdating = False
WorkRng.Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Introduction = "Please read this email."
.Item.To = ""
.Item.Subject = "information of kte"
.Item.Send
End With
Application.ScreenUpdating = True
End Sub
Note: In the above code, you can change the following information to your need.
- .Introduction = "Please read this email."
- .Item.To = ""
- .Item.Subject = "information of kte"
3. Then click F5 key to run this code, and a prompt box will pop out to remind you to selecting a range that you want to send.
4. Then click OK, and a prompt box will appear, after the progress bar finishing, click Allow, and then the specific range of cells has been sent to your recipient as message body.
Notes:
1. These codes are only available when the Outlook as your mail program.
2. After sending the current worksheet, you can go to your Outlook to make sure whether the email has been sent successfully.
Related articles:
How to send worksheet only through Outlook from Excel?
How to send current workbook through Outlook from Excel?
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

















