Beste,
Via een range in excel wil ik per mailadres (kolom B) een standaardmail verzenden. Per mail moet dan een nr (kolom A) toegevoegd worden aan het onderwerp.
Verder zijn het onderwerp en de tekst van de mail voor iedereen gelijk.
Ik heb op dit moment de volgende code:
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("A").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "C").Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Opschonen contactpersonen artikeldata" & Cells(cell.Row, "A").Value_
.Body = "Beste collega, Hierbij een test mail. Groet, Gerwin en Michael " & Cells(cell.Row, "A").Value _
& vbNewLine & vbNewLine
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
Kan iemand mij hiermee verder helpen.
Alvast bedankt.
Groet,
Gerwin
Via een range in excel wil ik per mailadres (kolom B) een standaardmail verzenden. Per mail moet dan een nr (kolom A) toegevoegd worden aan het onderwerp.
Verder zijn het onderwerp en de tekst van de mail voor iedereen gelijk.
Ik heb op dit moment de volgende code:
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("A").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "C").Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Opschonen contactpersonen artikeldata" & Cells(cell.Row, "A").Value_
.Body = "Beste collega, Hierbij een test mail. Groet, Gerwin en Michael " & Cells(cell.Row, "A").Value _
& vbNewLine & vbNewLine
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
Kan iemand mij hiermee verder helpen.
Alvast bedankt.
Groet,
Gerwin