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 with multiple attachments attached in Excel?

This article is talking about sending an email through Outlook with multiple attachments attached in Excel.

Send email with multiple attachments attached in Excel with VBA code

Quickly send email with multiple attachments attached in Excel with Kutools for Excel

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.

Send email with multiple attachments attached in Excel with VBA code


Please do as follows to send an email with multiple attachments attached in Excel.

1. Please insert a command button by clicking Developer > Insert > Command Button (ActiveX Control). See screenshot:

2. After inserting the Command Button, please right click it and select View Code from the context menu.

3. In the opening Microsoft Visual Basic for Applications window, please click Tools > References as below screenshot shown.

4. In the References – VBAProject dialog box, please find and check the Microsoft Outlook Object Library option, and then click the OK button.

5. Then replace the original code in the Code window with below VBA code.

VBA code: Send email attached with multiple attachments in Excel

Private Sub CommandButton1_Click()
    Dim xStrFile As String
    Dim xFilePath As String
    Dim xFileDlg As FileDialog
    Dim xFileDlgItem As Variant
    Dim xOutApp As Outlook.Application
    Dim xMailOut As Outlook.MailItem
    Application.ScreenUpdating = False
    Set xOutApp = CreateObject("Outlook.Application")
    Set xMailOut = xOutApp.CreateItem(olMailItem)
    Set xFileDlg = Application.FileDialog(msoFileDialogFilePicker)
    If xFileDlg.Show = -1 Then
        With xMailOut
            .BodyFormat = olFormatRichText
            .To = "happy.xuebi@163.com"
            .Subject = "test"
            .HTMLBody = "test"
            For Each xFileDlgItem In xFileDlg.SelectedItems
                .Attachments.Add xFileDlgItem
            Next xFileDlgItem
            .Display
        End With
    End If
    Set xMailOut = Nothing
    Set xOutApp = Nothing
    Application.ScreenUpdating = True
End Sub

Note: please specify your email recipient, subject, and body by changing the variate in .To = happy.xuebi@163.com, .Subject = "test" and .HTMLBody = "test" lines in the code.

6. Press the Alt + Q keys together to exit the Microsoft Visual Basic for Applications window.

7. Click Developer > Design Mode to turn off the Design Mode. See screenshot:

8. Click the Command Button to run the code. In the popping up Browse window, select the files you need to attach in the email, and then click the OK button. See screenshot:

9. Then an email is created with specified fields and attachments listed out. Please click the Send button to send it. See screenshot:

Note: The VBA code is only working when you use Outlook as your email program.


  Quickly send email with multiple attachments attached in Excel with Kutools for Excel

This section will recommend you the Send Emails utility of Kutools for Excel. With this utility, you can easily send email with multiple attachments attached in Excel. Please do as follows.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.

1. Follow as the below screenshot shown to create a mailing list. And fill in the recipient’s email address, the email subject, and the paths of attachments you need to attach in the sending email.

2. Select the whole mailing list you have created just now (here I select range A1:E2), then click Enterprise > Send Emails. See screenshot:

2. In the popping up Send Emails dialog box, please do the following configurations:

A. The To, Attach files and Subject fields will be filled with the selected mailing lists automatically;

B. Compose the email body as you need;

C. Check the Send email via Outlook box;

D. Click the Send button to send the email. See screenshot:

3. Then a Kutools for Excel dialog box pops up to tell you how many emails have been sent. Please click the OK button and close the Send Emails dialog box. See screenshot:

Note: You can go to the Outlook’s Sent Items folder to check for the sending emails.

Tip.If you want to have a free trial of this utility, please go to download the software freely first, and then go to apply the operation according above steps.


Related articles:


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.
    Kailas Naik · 3 months ago
    HI Team ....i am unable to see the attachment in mail so if i follow the your step...can you pls help
  • To post as a guest, your comment is unpublished.
    Regina · 11 months ago
    the above code works perfectly thanks!! but my email automatic signature seem to disappear with this code. any idea why?
  • To post as a guest, your comment is unpublished.
    Rizwan Siddiqui · 1 years ago
    What if multiple different user and different attachment to be send with different subject line.
  • To post as a guest, your comment is unpublished.
    Prashant Soni · 1 years ago
    What if above files are located in sub-folders? How to look for a file in folder and sub-folders?
  • To post as a guest, your comment is unpublished.
    Laurel Granger · 1 years ago
    I am able to "Quickly send email with multiple attachments attached in Excel with Kutools for Excel" using your steps above, but would like to take it one step further and personalize each email by inserting their names (from a column in the Excel sheet) into the body of the email. While in the body of the email, I try selecting the field and clicking on "Insert Placeholder" but nothing happens. Any idea why or how I can fix this? Thank you!