Option Explicit
Public Sub Test()
Const olMailItem = 0
Dim olApp As Object
Dim blnCreated As Boolean
On Error Resume Next
Set olApp = GetObject(Class:="Outlook.Application")
On Error GoTo 0
If olApp Is Nothing Then
Set olApp = CreateObject("Outlook.Application")
blnCreated = True
End If
With olApp.CreateItem(olMailItem)
.To = "recipient@example-domain.com"
.Subject = "Test - " & Now()
.HTMLBody = "<span style=""color:rgb(200,0,200)"">Hello MS Outlook.</span>"
.Save
End With
If blnCreated Then
olApp.Quit
End If
Set olApp = Nothing
End Sub
Landet beim Speichern automatisch im Ordner für Entwürfe.
Grüße
|