+ Reply to Thread
Results 1 to 4 of 4

Auto emailing in the BCC column

Hybrid View

  1. #1
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,439

    Re: Auto emailing in the BCC column

    Try:

    Sub sEmail()
        Dim OutApp
        Dim OutMail
        Dim cell As Range
        Dim sbcc As String
        For Each cell In Range("L4:L23")
            strbody = strbody & cell.Value & vbNewLine
        Next
        
        Application.ScreenUpdating = False
        Set OutApp = CreateObject("Outlook.Application")
    
        On Error GoTo cleanup
        For Each cell In Columns("D").Cells.SpecialCells(xlCellTypeConstants)
            If cell.Value Like "?*@?*.?*" _
            And LCase(Cells(cell.Row, "E").Value) = "yes" _
            Then
                sbcc = sbcc & cell.Value & ";"
            End If
        Next cell
    
        If sbcc <> "" Then
            Set OutMail = OutApp.CreateItem(0)
            On Error Resume Next
            With OutMail
                .To = ""
                .BCC = sbcc
                .Subject = "Quotation Request"
                .Body = "Dear " & Cells(cell.Row, "B").Value & vbNewLine & strbody
                .SendUsingAccount = OutApp.Session.Accounts.Item(3)
                .Display  'Or use Display
            End With
            On Error GoTo 0
            Set OutMail = Nothing
        End If
    
    cleanup:
        Set OutApp = Nothing
        Application.ScreenUpdating = True
    End Sub

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  2. #2
    Registered User
    Join Date
    09-18-2012
    Location
    oxford, uk
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Auto emailing in the BCC column

    TMShucks,

    Thats brilliant,

    thank you
    Tom

+ 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