<strong>Userform1:
</strong>
Private
Sub
CommandButton1_click()
Dim
outObj
As
Object
Dim
Mail
As
Object
Dim
i
As
Integer
Set
outObj = CreateObject(
"Outlook.Application"
)
Set
Mail = outObj.CreateItem(0)
With
Mail
.Subject =
"[Text1]"
End
With
UserForm1.Hide
Mail.Display
Set
Mail =
Nothing
Set
outObj =
Nothing
End
Sub
Private
Sub
CommandButton2_click()
Dim
outObj
As
Object
Dim
Mail
As
Object
Dim
i
As
Integer
Set
outObj = CreateObject(
"Outlook.Application"
)
Set
Mail = outObj.CreateItem(0)
With
Mail
.Subject =
"[Text2]"
End
With
UserForm1.Hide
Set
Mail =
Nothing
Set
outObj =
Nothing
End
Sub
Private
Sub
CommandButton3_click()
Dim
outObj
As
Object
Dim
Mail
As
Object
Dim
i
As
Integer
Set
outObj = CreateObject(
"Outlook.Application"
)
Set
Mail = outObj.CreateItem(0)
With
Mail
.Subject =
"[Text3]"
End
With
UserForm1.Hide
Mail.Display
Set
Mail =
Nothing
Set
outObj =
Nothing
End
Sub
Private
Sub
CommandButton4_click()
Dim
outObj
As
Object
Dim
Mail
As
Object
Dim
i
As
Integer
Set
outObj = CreateObject(
"Outlook.Application"
)
Set
Mail = outObj.CreateItem(0)
With
Mail
.Subject =
"[Text4]"
End
With
UserForm1.Hide
Mail.Display
Set
Mail =
Nothing
Set
outObj =
Nothing
End
Sub
Klassemodul:
<strong>clsInspectors:</strong>
Option
Explicit
Private
WithEvents
mobjInspectors
As
Inspectors
Private
Sub
Class_Terminate()
Set
mobjInspectors =
Nothing
End
Sub
Friend
Property
Set
Inspectors(
ByRef
probjInspectors
As
Inspectors)
Set
mobjInspectors = probjInspectors
End
Property
Private
Sub
mobjInspectors_NewInspector(
ByVal
Inspector
As
Inspector)
If
Inspector.CurrentItem.
Class
= olMail
Then
UserForm1.show
End
If
End
Sub