J
John Riddle
Hello,
I'm trying to replace the code behind my Outlook forms with VBA code, but am
having trouble capturing the events. Here's what I've got so far:
Public WithEvents VBAInspectors As Inspectors
Public WithEvents VBAInspector As Inspector
Public WithEvents VBAContact As ContactItem
Private Sub Initialize_Handler()
Set VBAInspectors = Application.Inspectors
End Sub
Private Sub Application_Startup()
Initialize_Handler
End Sub
Private Sub VBAContact_Open(Cancel As Boolean)
MsgBox "Item Opened"
End Sub
Private Sub VBAInspector_Activate()
Set objItem = VBAInspector.CurrentItem
If objItem.MessageClass = "IPM.Contact" Then
Set VBAContact = VBAInspector.CurrentItem
MsgBox VBAContact.FullName
Else
Set VBAContact = Nothing
End If
End Sub
Private Sub VBAInspectors_NewInspector(ByVal Inspector As Inspector)
Set VBAInspector = Inspector
End Sub
The "MsgBox VBAContact.FullName executes fine, but the "Item Opened" message
in the VBAContact_Open event does not fire.
Any suggestions?
Thanks,
John
I'm trying to replace the code behind my Outlook forms with VBA code, but am
having trouble capturing the events. Here's what I've got so far:
Public WithEvents VBAInspectors As Inspectors
Public WithEvents VBAInspector As Inspector
Public WithEvents VBAContact As ContactItem
Private Sub Initialize_Handler()
Set VBAInspectors = Application.Inspectors
End Sub
Private Sub Application_Startup()
Initialize_Handler
End Sub
Private Sub VBAContact_Open(Cancel As Boolean)
MsgBox "Item Opened"
End Sub
Private Sub VBAInspector_Activate()
Set objItem = VBAInspector.CurrentItem
If objItem.MessageClass = "IPM.Contact" Then
Set VBAContact = VBAInspector.CurrentItem
MsgBox VBAContact.FullName
Else
Set VBAContact = Nothing
End If
End Sub
Private Sub VBAInspectors_NewInspector(ByVal Inspector As Inspector)
Set VBAInspector = Inspector
End Sub
The "MsgBox VBAContact.FullName executes fine, but the "Item Opened" message
in the VBAContact_Open event does not fire.
Any suggestions?
Thanks,
John