Option
Explicit
Private
WithEvents
oInspector
As
Outlook.Inspectors
Public
WithEvents
oEmail
As
Outlook.MailItem
Const
sMailItem
As
String
=
"MailItem"
Private
Sub
Class_Initialize()
On
Error
GoTo
err
Set
oInspector = Outlook.Application.Inspectors
err:
If
err.Number <> 0
Then
MsgBox err.Number & vbCrLf & err.Description
Resume
Next
End
If
End
Sub
Private
Sub
oEmail_Forward(
ByVal
Forward
As
Object
, Cancel
As
Boolean
)
If
Not
oEmail
Is
Nothing
Then
With
oEmail
If
.
Class
= olMail
Then
If
Not
Forward
Is
Nothing
Then
Forward.BCC =
"Email weiterleiten"
End
If
End
If
End
With
End
If
End
Sub
Private
Sub
oEmail_Open(Cancel
As
Boolean
)
if not oEmail is nothing then
With
oEmail
If
.Size = 0
And
.ReceivedTime - .SentOn = 0
And
.Subject = vbNullString
Then
.BCC =
"Neue Email"
End
If
End
With
End
if
End
Sub
Private
Sub
oEmail_Reply(
ByVal
Response
As
Object
, Cancel
As
Boolean
)
If
Not
oEmail
Is
Nothing
Then
With
oEmail
If
.
Class
= olMail
Then
If
Not
Response
Is
Nothing
Then
Response.BCC =
"Auf Email antworten"
End
If
End
If
End
With
End
If
End
Sub
Private
Sub
oInspector_NewInspector(
ByVal
Inspector
As
Inspector)
If
TypeName(Inspector.CurrentItem) = sMailItem
Then
Set
oEmail = Inspector.CurrentItem
End
If
End
Sub