How to Send Excel File to Email Automatically.

August 14, 2019

Automatically sending an excel file to someone via an email, can be accomplished easily and with ease. Following the brief guide below you will be able to do this in no time at all. From the basics to a more complex approach, here we have provided all the information you need to start sending files directly to email. While most people won’t ever use this, it is better to know it and not need it than to need it and not know it.

There are different approaches for this same purpose, we take pride in presenting the easiest and fastest one. For the guide below we will be using the Outlook platform and we’ll take the VBA approach. Without further ado we present.

How to send excel file to email automatically.

Let’s begin with the basics, first you want to make a separate sheet for the following process.

Step 1.

In the new sheet you want to use different columns for different fields of information. In this example column A will be destined for the name of the recipient, column B for their email addresses and column C will be used for the file names. In this case instead of using file names you want to use the route of the file.

Step 2.

Now this is the main part, you want to open the VBA editor by using the shortcut Alt + F11. Then you can use Ctrl + r to open the project explorer. After that, you need to insert a module in your project before you can use it for the code. Click on Insert and then on Module.

working on excel sheet

Step 3.

Now you should click in the project explorer and then press F7, or simply double click on the newly created module. A new window should open up, this is where the interesting happens. Now you want copy and paste the code below.

Sub Send_Files()
'Working for Excel 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim sh As Worksheet
Dim cell As Range
Dim FileCell As Range
Dim rng As Range
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set sh = Sheets("Sheet1")
Set OutApp = CreateObject("Outlook.Application")
For Each cell In sh.Columns("B").Cells.SpecialCells(xlCellTypeConstants)
'Enter the path/file names in the C:Z column in each row
Set rng = sh.Cells(cell.Row, 1).Range("C1:Z1")
If cell.Value Like "?*@?*.?*" And _
Application.WorksheetFunction.CountA(rng) > 0 Then
Set OutMail = OutApp.CreateItem(0)
With OutMail
.to = cell.Value
.Subject = "Testfile"
.Body = "Hi " & cell.Offset(0, -1).Value
For Each FileCell In rng.SpecialCells(xlCellTypeConstants)
If Trim(FileCell) <> "" Then
If Dir(FileCell.Value) <> "" Then
.Attachments.Add FileCell.Value
End If
End If
Next FileCell
.Send
'Or use .Display
End With
Set OutMail = Nothing
End If
Next cell
Set OutApp = Nothing
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub

Step 4.

After That’s done you want to use Alt + q to go back to your Excel sheet. When that's done, you can use Alt + F8 to run the newly created macro.

Precautions.

Do be sure to inspect the code we have provided for you and change it in any way you deem necessary. Remember that this should be done to suit your needs. Also, leep present that in order for this macro to run you need to have your Outlook client active or minimized, but open.

Conclusion.

With this brief process you’re able to automatize the process of sending files to emails. All that it’s needed for this is to run the macro we have provided for you. You can make your work a lot easier and faster with this option, this is likely to increase your workflow just by knowing how to best take advantage of your Microsoft Excel software and Outlook client. If you like this kind of content and want to see more, please be sure to visit us at our blog.

July 1, 2022
How To Ping An Email Address To Validate It

Do you ever wonder whether an email address is a legitimate or a false email address when it bounces back? Probably the easiest method to handle this is to ping an email address, and in this article, we will demonstrate how to ping and validate an email address. Validating emails by pinging different addresses is […]

Read More
June 29, 2022
The Best Email Services To Not Ask for Phone Verification

With everything becoming tech-based around us, it only makes sense that we turn to the internet for required services and needs. However, that is also when we truly feel the importance of "Emails." Today, an email account is the one thing that can help you sign up for any service or platform. It is one […]

Read More
May 16, 2022
How Email Verification Works: The Ultimate Guide

Following the creation of your email lead list, email verification is one of the most critical phases in any email marketing campaign. If you don't verify your emails - all the hard work you put into your email marketing campaign essentially becomes worthless. Now you, along with many others, might be scared of your email […]

Read More
May 14, 2022
How to Clean Out Old Emails In Bulk From Your Gmail Account

If you have been getting notified of your account storage space recently, and your Gmail looks something like this, then take this as a sign to clean up your old emails. If you’ve been running out of space in your google account, you have two options to fix it. First, you can start paying for […]

Read More
envelope-ophoneinstagramgraduation-hatstorephone-handsetchart-barseartharrow-right