Hej.
Har en kodsträng som automatiserar mailutskick från excel. Fungerar fint, bortsett från att mailsignaturen försvinner när ".Body" är aktiv. Är den avaktiverad öppnas mailformuläret med signaturen.
Vad är fel ? Tacksam för hjälp.
Kod:
Sub Test_utskick()
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" _
And LCase(Cells(cell.Row, "D").Value) <> "send" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Hej " & Cells(cell.Row, "A").Value & ","
.Body = "Text Rad 1 Text Rad 1" & vbNewLine & _
"Text Rad 2 Text Rad 2"
'.Send 'Eller
.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