asantos2015
New Member
- Joined
- Nov 26, 2015
- Messages
- 4
Hello Folks,
Can you guys have a look at the code below and fix the part where it gets only the rows meeting a criteria "Repor" in column O and throws it in the body of the email?
The code below is sending the entire table (11MB).
THANK YOU!
Can you guys have a look at the code below and fix the part where it gets only the rows meeting a criteria "Repor" in column O and throws it in the body of the email?
The code below is sending the entire table (11MB).
THANK YOU!
Rich (BB code):
ub CDO_Mail_Small_Text()
Dim iMsg As Object
Dim iConf As Object
Dim strbody As String
' Dim Flds As Variant
Dim rng As Range
Dim j As Integer
Dim Source As Worksheet
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
' Set Source = ActiveWorkbook.Worksheets("All")
Set rng = Sheets("Ponto de Reposição").Range("A7:O8000").SpecialCells(xlCellTypeVisible)
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "antonio@ataldacastanha.com.br"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "hope2015"
.Update 'Let CDO know we have change the default configuration for this message
End With
For Each rng In Sheets("Ponto de Reposição").Range("a7:o8000") ' This part is the one messed up.
If rng = "Repor" Then
rng.Rows ("C" & c.Row & ":B" & c.Row)
j = j + 1
End If
Next rng
' If Sheets("Ponto de Reposição").Range("o10").Value = "Repor" Then
' strbody = "Atenção! Esses itens chegaram no estoque mínimo." & " Favor verificar imediatamente e confirmar a necessidade de compra! & ValueofColumn E"
' strbody = "Atenção! Esses itens chegaram no estoque mínimo." & " Favor verificar imediatamente e confirmar a necessidade de compra!" & vbNewLine & _
"<br>" & "<br>" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
With iMsg
Set .Configuration = iConf
.To = "antonio@ataldacastanha.com.br"
.CC = "antoniosan0@hotmail.com"
.BCC = ""
.From = """Estoque"" <antonio@ataldacastanha.com.br>"
.Subject = "Atenção! Estoque de Insumos e MP baixo!"
.HTMLBody = RangetoHTML(rng)
.Send
End With
End Sub
Last edited by a moderator: