T
Ted Byers
NB: I am using VB, not VBA.
Here are two event handlers I created:
Private Sub objContactItem_PropertyChange(ByVal Name As String)
MsgBox (Name & " was changed.")
End Sub
Private Sub objContactItem_Write(Cancel As Boolean)
MsgBox (Name & " was changed.")
End Sub
And here is how objContactItem is declared:
Private WithEvents objContactItem As Outlook.ContactItem
And here is how it is initialized:
Set objContactItem = objOutlook.ContactItem
I assume I need to initialize objContactItem with a contact item in order to
be able to get the events, and not just declare it, and I need it to be set
to the value of the contact item that was changed.
I do not know if this is right, though, since ContactItem did not appear in
the dropdown list that appeared after I typed "objOutlook."
And can someone show me how to access the data members of objContactItem
(which I assume is populated with the edited contact item when the event is
passed to my COM object). I would assume that once I get the initialization
right, I should be able to access the data members directly.
What I don't see happening, at present, is the messagebox that is supposed
to be displayed in the event handlers, suggesting that my COM object is not
being notified of these events. Why?
Any help would be appreciated.
NB: I have been trying, in both VC++6 and VB6, but with great frustration
with inadequate documentation.
Thanks
Ted
Here are two event handlers I created:
Private Sub objContactItem_PropertyChange(ByVal Name As String)
MsgBox (Name & " was changed.")
End Sub
Private Sub objContactItem_Write(Cancel As Boolean)
MsgBox (Name & " was changed.")
End Sub
And here is how objContactItem is declared:
Private WithEvents objContactItem As Outlook.ContactItem
And here is how it is initialized:
Set objContactItem = objOutlook.ContactItem
I assume I need to initialize objContactItem with a contact item in order to
be able to get the events, and not just declare it, and I need it to be set
to the value of the contact item that was changed.
I do not know if this is right, though, since ContactItem did not appear in
the dropdown list that appeared after I typed "objOutlook."
And can someone show me how to access the data members of objContactItem
(which I assume is populated with the edited contact item when the event is
passed to my COM object). I would assume that once I get the initialization
right, I should be able to access the data members directly.
What I don't see happening, at present, is the messagebox that is supposed
to be displayed in the event handlers, suggesting that my COM object is not
being notified of these events. Why?
Any help would be appreciated.
NB: I have been trying, in both VC++6 and VB6, but with great frustration
with inadequate documentation.
Thanks
Ted