Consulting

Results 1 to 2 of 2

Thread: Sending emails to multiple recipients

  1. #1
    VBAX Newbie
    Joined
    Mar 2006
    Posts
    2
    Location

    Sending emails to multiple recipients

    I have code to send an attachment each day to multiple recipients. The code sends the attachment separately to each person but since we just upgraded to 2003, it now brings up a message each time it trys to send the email:
    "A program is trying to automatically send e-mail on your behalf. Do you want to allow this? If this is unexpected, it may be a virus and you should choose No".
    You have to select Yes each time for the email to go through. It gets time consuming because there are about 30 recipients receiving the email.
    If I could send just one email with the attachment to all recipients at once would help. Or if anyone knows of a way to get rid of that prompt would help also. Below is the code currently being used. Any advice is greatly appreciated. I am a novice at VBA.

    [VBA] Sub Send_All_Email()
    '
    ' Send_Email Macro
    On Error GoTo Out:
    MyCheck = MsgBox("Have you entered TODAYS DATE - Emails may take 30 secs. to send", vbYesNo)
    If MyCheck = vbNo Then
    Exit Sub
    Else
    Range("h50").Select
    Range("h5").Select
    GoTo Start
    End If
    Start:
    Call Password
    ActiveWorkbook.SendMail "Person1.org", "Today's Report", Null
    ActiveWorkbook.SendMail "Person2.org", "Today's Report", Null
    ActiveWorkbook.SendMail "Person3.org", "Today's Report", Null
    ActiveWorkbook.SendMail "Person4.org", "Today's Report", Null
    ActiveWorkbook.SendMail "Person5.org", "Today's Report", Null
    'Application.Dialogs(xlDialogSendMail).Show
    GoTo Good:
    Out:
    MsgBox ("ERROR: Emails were NOT sent - Try Again or call IS at 123-4567")
    MsgBox Err.Description, vbCritical
    Range("h50").Select
    Range("D5").Select
    Exit Sub
    Good:
    MsgBox ("SUCCESS: All emails were sent")
    MsgBox ("Verify emails were sent - check your SENT items before erasing data")
    'MyCheck = MsgBox("Are You Ready to Erase ALL DATA", vbYesNo)
    ' If MyCheck = vbNo Then
    ' Exit Sub
    ' Else
    ' Call Erase_All_Data
    'End If
    Range("h50").Select
    Range("D5").Select
    Exit Sub
    End Sub[/VBA]

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Thread in the outlook forum addresses this issue:
    http://vbaexpress.com/forum/showthread.php?t=7847
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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