Gruppe
Extern
Problem
Wie kann ich den Inhalt von Zelle A1 an eine vorgegebene Email-Adresse über Outlook versenden?
StandardModule: basMain
Sub SendMessage()
Dim oOL As Object
Dim oOLMsg As Object
Dim oOLRecip As Object
Dim sAddress As String
sAddress = Range("D1").Value
Set oOL = CreateObject("Outlook.Application")
Set oOLMsg = oOL.CreateItem(0)
With oOLMsg
Set oOLRecip = .Recipients.Add(sAddress)
.Subject = "Dies ist ein Outlook-Test"
.Body = ActiveSheet.Range("A1").Value
.Importance = 1
.Send
End With
oOLRecip.Resolve
Set oOLRecip = Nothing
Set oOLMsg = Nothing
Set oOL = Nothing
End Sub