Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2001
    Posts
    45

    Question Unanswered: How to automate Emails to more than One User with DoCmd.SendObject ?

    When I use this code, an Outlook Message Window appears, fills in some Address stuff and leaves it to the user to add text and eventually press SEND:

    DoCmd.SendObject , , acFormatRTF, Me.strEmail.Value, , , "Email Subject", "", True

    What can I do, to provoke some kind of Mass Mailing (Automating the SEND-Button?)? Is it possible to DoCmd.SendObject without any further User Action? To send several seperated Emails with one Click? (Not using the CC or BCC fields and ONE Email)

  2. #2
    Join Date
    Jul 2002
    Posts
    27
    I use the following code in excel to send a specific file to each person I am emailing based on a list of file names and email addresses in an excel spreadsheet.

    Note the line myitem.send (simply sends the object myitem that happens to be the email message). You can also add details to the subject and the message of the email etc.

    Let me know if you need more...


    Sub statimsend()
    Dim filesendpath, filesendname, filesendnamecell, filesendrecp, filesendrecpcell, filesendfullpathname As String
    Dim counter
    counter = 0
    Do While counter < 136
    counter = counter + 1
    Set myOlApp = CreateObject("Outlook.Application")
    Set myitem = myOlApp.CreateItem(olMailItem)
    Set myAttachments = myitem.Attachments
    filesendpath = ActiveSheet.Range("a1").Value
    filesendnamecell = ("b" + CStr(counter))
    filesendname = ActiveSheet.Range(filesendnamecell).Value
    filesendrecpcell = ("c" + CStr(counter))
    filesendrecp = ActiveSheet.Range(filesendrecpcell).Value
    filesendfullpathname = (filesendpath) + (filesendname)
    myAttachments.Add (filesendfullpathname)
    Set myRecipient = myitem.Recipients.Add(filesendrecp)
    myitem.Subject = ("STATIM DATA ATTACHED IN ZIP FORMAT")
    myitem.Send
    Loop
    MsgBox ("EMAIL CREATION AND SEND IS NOW COMPLETE")
    End Sub

  3. #3
    Join Date
    Jul 2002
    Location
    Romania
    Posts
    122
    Yes, you can send one email to several recipients. Just build your recipient list as a string separated by semicolon and it will work. If you change True to False, the mail message will be sent immediately, without opening for edit.

    DoCmd.SendObject acSendReport, "ReportName", acFormatRTF, "user1@company.com; user2@company.com; user3@company.com", , , "Subject", "Message body", True

    HTH,

    dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •