Share via

Sending outlook email via visual basic macro

Randy Ricker 0 Reputation points
2026-02-08T00:00:25.4933333+00:00

Attempting to use excel macro to send out email list excel macro.

Outlook | Windows | Classic Outlook for Windows | For home
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Hornblower409 5,795 Reputation points
    2026-02-08T07:13:42.37+00:00

    Do you have MSOUTL.OLB in C:\Program Files\Microsoft Office\root\Office16 ?

    If so, reference it. If not then you do not have Classic Outlook installed or it needs to be repaired.
    https://support.microsoft.com/en-us/office/repair-an-office-application-7821d4b6-7c1d-4205-aa0e-a6b40c5bb88b

    0 comments No comments

  2. Randy Ricker 0 Reputation points
    2026-02-08T00:10:07.5933333+00:00

    I tried that code. I am getting error indicating that oulook object is not available. I tried to use references to add Microsoft Outlook Object Library but do not see it in the list of references.

    0 comments No comments

  3. Q&A Assist
    2026-02-08T00:00:35.0066667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To send an email using an Excel macro that utilizes Outlook, you can use Visual Basic for Applications (VBA). Below is a basic example of how to set up your macro to send emails to a list of recipients stored in an Excel workbook:

    1. Open Excel and press ALT + F11 to open the Visual Basic for Applications (VBA) editor.
    2. Insert a new module by right-clicking on any of the items in the Project Explorer, selecting Insert, and then Module.
    3. Copy and paste the following code into the module:
         Sub SendEmails()
             Dim OutlookApp As Object
             Dim OutlookMail As Object
             Dim Recipient As Range
             Dim EmailBody As String
         
             ' Create a new Outlook application
             Set OutlookApp = CreateObject("Outlook.Application")
         
             ' Loop through each recipient in column A
             For Each Recipient In ThisWorkbook.Sheets("Sheet1").Range("A1:A10") ' Adjust the range as needed
                 If Recipient.Value <> "" Then
                     Set OutlookMail = OutlookApp.CreateItem(0)
                     With OutlookMail
                         .To = Recipient.Value
                         .Subject = "Your Subject Here"
                         .Body = "Your email body here"
                         .Send
                     End With
                 End If
             Next Recipient
         
             ' Clean up
             Set OutlookMail = Nothing
             Set OutlookApp = Nothing
         End Sub
      
    4. Adjust the range in the code to match where your email addresses are located in the Excel sheet (e.g., A1:A10). You can also customize the subject and body of the email.
    5. Run the macro by pressing F5 or by selecting Run from the menu.

    This will send an email to each recipient listed in the specified range in your Excel sheet.


    References:


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.