Send email message from excel

You can send an email message from Excel using VBA (Visual Basic for Applications) programming. Here's a step-by-step guide:

Prerequisites:

  1. You need to have Excel 2007 or later version.
  2. You need to have Outlook installed on your computer.

Step 1: Enable the Developer Tab

  1. Go to the "File" menu and click on "Options".
  2. In the "Excel Options" dialog box, click on the "Customize Ribbon" button.
  3. Check the box next to "Developer" and click "OK".

Step 2: Create a Macro

  1. Go to the "Developer" tab and click on the "Visual Basic" button.

  2. In the Visual Basic Editor, click on "Insert" > "Module" to insert a new module.

  3. Paste the following code into the module:

    Sub SendEmail()
     Dim olApp As Object
     Dim olMail As Object
    
     Set olApp = CreateObject("Outlook.Application")
     Set olMail = olApp.CreateItem(0)
    
     With olMail
        .To = "[email protected]" ' replace with recipient's email address
        .Subject = "Test Email from Excel" ' replace with subject line
        .Body = "This is a test email sent from Excel." ' replace with email body
        .Send
     End With
    
     Set olMail = Nothing
     Set olApp = Nothing
    End Sub

    Step 3: Run the Macro

  4. Go back to the Excel worksheet.

  5. Press "Alt + F8" to open the Macro dialog box.

  6. Select the "SendEmail" macro and click "Run".

Tips and Variations: