P
PatrickS
I have a support tool that I'm supposed to be maintaining. I'd like to be
able to have a button on the support call form that opens up an email in
Outlook (at this stage I can assume that it will only be Outlook
2000/2002/2003 being used) and then when the email is sent have the contents
of the email added as a note to the support call in the database.
I created a dummy VB project using VB6 to make sure I could do what I wanted
in this regard. I added a button to the form that creates a new instance of a
class and then calls the SendSupportMail() method. The contents of this class
are included below, however neither the ItemSend nor the Send events are
fired even though the emails themselves are successfully sent. Breakpoints
that I've added on the Msgbox statements are never reached.
What am I doing wrong?
--------------------------------------------------------Private WithEvents objApp As Outlook.Application
Private WithEvents objMail As Outlook.MailItem
Private Sub Class_Initialize()
Set objApp = Outlook.Application
End Sub
Private Sub objApp_ItemSend(ByVal Item As Object, Cancel As Boolean)
MsgBox "Test"
End Sub
Public Sub SendSupportMail()
Set objMail = objApp.CreateItem(olMailItem)
objMail.Display
End Sub
Private Sub objMail_Send(Cancel As Boolean)
MsgBox "Test2"
End Sub
able to have a button on the support call form that opens up an email in
Outlook (at this stage I can assume that it will only be Outlook
2000/2002/2003 being used) and then when the email is sent have the contents
of the email added as a note to the support call in the database.
I created a dummy VB project using VB6 to make sure I could do what I wanted
in this regard. I added a button to the form that creates a new instance of a
class and then calls the SendSupportMail() method. The contents of this class
are included below, however neither the ItemSend nor the Send events are
fired even though the emails themselves are successfully sent. Breakpoints
that I've added on the Msgbox statements are never reached.
What am I doing wrong?
--------------------------------------------------------Private WithEvents objApp As Outlook.Application
Private WithEvents objMail As Outlook.MailItem
Private Sub Class_Initialize()
Set objApp = Outlook.Application
End Sub
Private Sub objApp_ItemSend(ByVal Item As Object, Cancel As Boolean)
MsgBox "Test"
End Sub
Public Sub SendSupportMail()
Set objMail = objApp.CreateItem(olMailItem)
objMail.Display
End Sub
Private Sub objMail_Send(Cancel As Boolean)
MsgBox "Test2"
End Sub