Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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


You may interested in this utility:

Remove Duplicate Mails

Click Kutools > Duplicate > Mails to quickly list all duplicate emails, and then delete them at on click.
doc duplicate mail 1
doc arrow
doc duplicate mail 2

Office Tab Enable Tabbed Editing and Browsing in Office, and Make Your Work Much Easier...
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
  • Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
  • More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
  • Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
  • Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
  • Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
  • Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
  • More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.

arrow blue right bubbleSend 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:

Kutools for Excel, with more than 120 handy functions, makes your jobs easier. 

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 = "skyyang@extendoffice.com"
    .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 = "skyyang@extendoffice.com"
  • .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:

doc-send-range1

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.

doc-send-range2


arrow blue right bubbleSend 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 = "skyyang@extendoffice.com"
    .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 = "skyyang@extendoffice.com"
  • .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.

doc-send-range1

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.

doc-send-range2

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?


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

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!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    nagaraju · 4 months ago
    Hi,
    Everything looks good but but not giving the border selected range,Could you please suggest.
  • To post as a guest, your comment is unpublished.
    Vinay · 2 years ago
    Thanks, This is very useful but what if I need to add some description in mail body before sending it. Please suggest the code.
  • To post as a guest, your comment is unpublished.
    Naman · 2 years ago
    Hi ,
    Very Nicely Explained.

    Instead of sending a new workbook can we only copy and paste the selected range into email body and send. I dont want to send the selected Range as Image. I want to send
    like a table view in body of the email. Can we do that??
  • To post as a guest, your comment is unpublished.
    Jacquelene · 4 years ago
    Very useful. Thank you .
    I have list of email address on the same sheet . When i clicked to one email address , the selected range of cells will be sent as attachment to this email. Can please help me on this?Many Thanks.
  • To post as a guest, your comment is unpublished.
    hemant · 4 years ago
    nice & useful ,good job!!!
  • To post as a guest, your comment is unpublished.
    shanu · 5 years ago
    Hi,

    Can you please let me know how to add signature and second introduction line to this mail for the second program.

    Thanks in advance.
  • To post as a guest, your comment is unpublished.
    Renee · 5 years ago
    Hi,

    im using the marco which selects the cells required to email.
    i have combined this with another macro so that i get it to open an "new email"
    my problem is now that if you put alot of information into one cell then it only takes the iformaiton you view not all the information in that cell

    any ideas ??

    thank you soooooo much for your help with this

    cheers