You might be having Gmail or Yahoo accounts for sending and receiving emails. But, Excel offers the option to send emails directly from Excel itself. Suppose, you are busy with some Excel application and want to send an email to your manager or team member attaching the same Excel document you are working on. You can complete it in seconds without opening your Yahoo or Gmail inbox.
Step 1. Open Excel and save your file as email.xlsx.
Step 2. Go to the quick access tool bar and click E-mail (circled in red).
Now your quick access toolbar will look like this with an email icon.
Step 3. Click the email icon from the quick access toolbar and it will open your default email program. Here, Microsoft Outlook is the default email program and it gets opened.
You could see that your default email address has been filled automatically in the From address. The subject is automatically filled as the name of your Excel file and the same Excel file has been attached in the attachment section.
Step 4. If you want to change the from address click the From dropdown and click Other E-Mail address. In the new window, enter your email address in the textbox provided and click OK.
Step 5. Enter the email address of the recipient in the To textbox. You can also specify cc email ids if you want. If you want to change the subject, then change it.
Step 6. If you do not want to send the Excel file as an attachment or if you want to send another attachment, select the attachment from the textbox.
Press the DEL button on your keyboard. If you want to attach another file, go to Message (main menu in the Outlook) --> Attach File (in the Include category) and select the file you want to attach.
If your default email program is not Microsoft Outlook, then these options could be different.
Step 7. Enter your message in the space provided below the attachment option.
Step 8. Once all the details are entered, you need to click the Send button which will send your email to the recipient(s) you specified.
You might have to specify the server name, user name and password for sending emails directly from Excel. Instead of using the built-in Email sending feature of Excel, you can also write your own function to send emails.
Step 1. Enter data as shown in the following image:
Enter the to address (separated by comma if more than one) in cell B1, the subject of your email in cell B2, your message in cell B3 and full path to your attachment in cell B4 (eg: C:\Test\tt.txt).
Step 2. Press Alt + F11 which will open the VBA editor. Click Sheet1 from the left window.
Step 3. Enter the code given below in the window opened.
Dim objOutlook As Object
Dim objMail As Object
Dim rngTo As Range
Dim rngSub As Range
Dim rngMessage As Range
Dim rngAttachment As Range
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
Set rngTo = .Range("B1")
Set rngSub = .Range("B2")
Set rngMessage = .Range("B3")
Set rngAttachment = .Range("B4")
.To = rngTo.Value
.Subject = rngSub.Value
.Body = rngMessage.Value
.Display 'Instead of .Display, you can use .Send to send the email _
or .Save to save a copy in the drafts folder
Set objOutlook = Nothing
Set objMail = Nothing
Set rngTo = Nothing
Set rngSub = Nothing
Set rngMessage = Nothing
Set rngAttachment = Nothing
Step 4. Click the Save button which will open a new window.
Click the Yes button.
Step 5. Click the Run button.
This will open your default email program with all the details filled. You just need to click the Send button to send email.