+ Reply to Thread
Results 1 to 3 of 3

send email from XL list of email address

Hybrid View

  1. #1
    Registered User
    Join Date
    01-21-2004
    Location
    Liverpool
    MS-Off Ver
    2003
    Posts
    88

    send email from XL list of email address

    hi,

    I have a list of email address in exce in the range A1:A10

    I want to send an email one by one to them, i have the the following code as i don't want the annoying popup each time it sends an email but it doesn't seem to wrk even if i use outlook library references it doesnt work any help would be great

    code:
    Option Explicit
    Dim objOut As Object
    
    Sub SendBulkMail()
        Dim addresses As Range
        Set addresses = Range(Range("A1"), Range("A1").End(xlDown))
        Dim rAddr As Range
        
        Application.DisplayAlerts = False
        Set objOut = CreateObject("Outlook.Application")
        For Each rAddr In addresses.Rows
            Call SendMail(rAddr)
        Next rAddr
        Set objOut = Nothing
        
        Application.DisplayAlerts = True
    
    End Sub
    Sub SendMail(r As Range)
        Dim objMail As Object
        Dim OutApp As Object
        Dim strEmail As String
        Dim strSubject As String
        Dim strBody As String
        
        On Error Resume Next
        
        Set objMail = OutApp.CreateItem(0)
        strEmail = r.Cells(1, 2)
        strSubject = "subject line"
        strBody = "Boby of email"
        
        With objMail
            .To = strEmail
            .HtmlBody = strBody
            .Subject = strSubject
            .Attachments.Add ("C:\attachment1.doc")
            .Attachments.Add ("c:\attachment2.doc")
            .Send
        End With
    End Sub
    Thanks in advance
    regards
    Paul
    http://www.frontlineuk.com
    FrontLineUK

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,535

    Re: send email from XL list of email address

    The Security Prompt is generated by OL not XL

    see: http://www.rondebruin.nl/mail/prevent.htm

    I prefer to use CDO (see last paragraph) if mailing in large batches but this may or may not be viable in your case - failing that you really want to think about using 3rd Party like ClickYes.

  3. #3
    Registered User
    Join Date
    01-21-2004
    Location
    Liverpool
    MS-Off Ver
    2003
    Posts
    88

    Re: send email from XL list of email address

    Try the CDO didn't work for me =[

    Prob the security setting in work. just tells me there is an error each time.

    Think i may just have to do this the old fashion way

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1