• Outlook message from Excel

    Author
    Topic
    #356499

    Is there a way to have an Outlook message automatically sent to specific individuals when certain criteria is met in an Excel spreadsheet? If it is possible, should I originate the message using an Outlook form or from Excel?

    Viewing 0 reply threads
    Author
    Replies
    • #527802

      It is indeed possible – I’d suggest doing it from Excel as that’s where you’re testing to see if the criteria are met.
      Code would be something like this:
      Sub TestOL()
      Dim oOutlookApp As Object
      Dim Mail As MailItem
      Dim strMessage As String
      Set oOutlookApp = GetObject(, “outlook.application”)

      Set Mail = oOutlookApp.CreateItem(olMailItem)
      strMessage = “this is the message”
      With Mail
      .Subject = “Important e-mail”
      .To = “Everyone”
      .Body = strMessage
      .Display
      End With
      MsgBox “Send when ready.”
      End Sub
      If you set a reference to the Outlook object library you can use early binding too (e.g. Dim oOutlookApp as New Outlook.Application)
      Hope that helps.

    Viewing 0 reply threads
    Reply To: Outlook message from Excel

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: