![]() |
|
|
|
#1
|
|||
|
|||
|
HI. Code:
Sub Send_EMail()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo limpa
For Each cell In Columns("H").Cells.SpecialCells(xlCellTypeConstants)
'verifica se o email é valido e se o cliente possui o estados A (atrasado)
If cell.Value Like "?*@?*.?*" And LCase(Cells(cell.Row, "I").Value) = "a" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Aviso"
.Body = "Caro " & Cells(cell.Row, "B").Value _
& vbNewLine & vbNewLine & _
"Entre em contato com nosso serviço de cobrança " & _
"para tratar assunto de seu interesse com urgência"
'Podemos enviar um anexo
.Attachments.Add ("c:\dados\carta.txt")
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
MsgBox ("Email enviado com sucesso..." & " para " & Cells(cell.Row, "B").Value)
End If
Next cell
limpa:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
|
|
#2
|
|||
|
|||
|
Hi
Any idea? |
|
#3
|
||||
|
||||
|
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
I want to send email to large number of people, with different addressing
|
sanketmlad | Outlook | 1 | 10-06-2011 09:32 AM |
Send emails only during business hours
|
sdavisoftv | Outlook | 2 | 09-14-2011 10:21 AM |
| Outlook 2010 cannot send emails through Cox | navyveteran | Outlook | 0 | 03-14-2011 02:47 PM |
I want to know how I can send emails on my boss' behalf
|
Jen | Outlook | 2 | 07-29-2010 03:35 PM |
| Can't send emails | Sharon Garrett | Outlook | 0 | 12-14-2005 08:32 PM |