Hoi ik probeer een mail te sturen vanuit excel wanneer mijn opdracht status 100% is
dit lukt me echter niet enkel als de cel waarde in "F" 100 is lukt het perfect .
moet ik nog iets toevoegen zodat het met percentage getallen ook lukt ?
Code:
dit lukt me echter niet enkel als de cel waarde in "F" 100 is lukt het perfect .
moet ik nog iets toevoegen zodat het met percentage getallen ook lukt ?
Code:
Code:
Sub mail()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
For Each cell In Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "C").Value) = "yes" _
[COLOR=#ff0000]And LCase(Cells(cell.Row, "F").Value) = "100%" _[/COLOR]
And LCase(Cells(cell.Row, "D").Value) <> "send" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Reminder"
.Body = "Beste " & Cells(cell.Row, "A").Value _
& vbNewLine & vbNewLine & _
"De opdracht die gevraagd was is uitgevoerd " & _
Cells(cell.Row, "G").Value & _
"your account up to date."
'You can add files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'Or use Display
End With
On Error GoTo 0
Cells(cell.Row, "D").Value = "send"
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
Laatst bewerkt: