title: VBScript to Automate Outlook emails via Mail Merge
body: <p>Im looking for a VBScript that will automatically send an email to each person on a list of contacts I have in an excel tabel using a mail merge. </p>
  
  <p>Any help would be much appreciated and if you need more info just ask :)</p>
  
  <p>Basically I have this code</p>
  
  <pre><code>Sub SendMessage(DisplayMsg As Boolean, Optional AttachmentPath)
      Dim objOutlook As Outlook.Application
      Dim objOutlookMsg As Outlook.MailItem
      Dim objOutlookRecip As Outlook.Recipient
      Dim objOutlookAttach As Outlook.Attachment
  
    ' Create the Outlook session.
    Set objOutlook = CreateObject("Outlook.Application")
  
    ' Create the message.
    Set objOutlookMsg  = objOutlook.CreateItem(olMailItem)
  
    With objOutlookMsg
        ' Add the To recipient(s) to the message.
        Set objOutlookRecip = .Recipients.Add("Nancy Davolio")
        objOutlookRecip.Type = olTo
  
       ' Set the Subject, Body, and Importance of the message.
       .Subject = "This is an Automation test with Microsoft Outlook"
       .Body = "This is the body of the message." &amp;vbCrLf &amp; vbCrLf
       .Importance = olImportanceHigh  'High importance
  
       ' Resolve each Recipient's name.
       For Each ObjOutlookRecip In .Recipients
           objOutlookRecip.Resolve
       Next
  
       ' Should we display the message before sending?
       If DisplayMsg Then
           .Display
       Else
           .Save
           .Send
       End If
    End With
    Set objOutlook = Nothing
  End Sub
  </code></pre>
  
  <p>But I need it to, instead of creating an email, it uses a mail merge, and the email is to be sent to everyone on a list stored in an excel sheet, problem is, I have no idea how to do this so any help would be great!</p>
  
  <p>Thanks</p>