Option
Explicit
Private
Sub
TextBox1_KeyDown(
ByVal
KeyCode
As
MSForms.ReturnInteger,
ByVal
Shift
As
Integer
)
If
Not
KeyCode = 115
Then
Exit
Sub
ElseIf
Me
.TextBox1.Text = vbNullString
Then
Exit
Sub
End
If
Dim
appOut
As
Outlook.Application
Dim
outMail
As
Outlook.MailItem
On
Error
Resume
Next
Set
appOut = GetObject(
"Outlook.Application"
)
If
Err.Number <> 0
Then
Set
appOut = CreateObject(
"Outlook.Application"
)
End
If
On
Error
GoTo
0
Set
outMail = appOut.CreateItem(olMailItem)
With
outMail
.
To
=
Me
.TextBox1.Text
.Subject =
"Eine E-Mail aus Micrsoft Excel"
.HTMLBody =
"<h1>Dies ist eine Test E-Mail</h1>"
& _
"<p>Diese E-Mail wurde mithilfe von VBA aus Microsoft Excel heraus erstellt.</p>"
.Display
End
With
Set
outMail =
Nothing
Set
appOut =
Nothing
End
Sub