M
MIchael
Hello
I am monitoring a public contacts folder (on an exchange server). Every time a contact is changed a program should be launched.
But the event occures even when the contact is only opened. Nothing needs to be changed to let the event fire.
Do I need to take an other event?
My code is below
Thank you very much for your help!!!!
Michael
Public WithEvents colPubCustomersItems As Outlook.Items
Public Sub Application_Startup()
Set objFolders = Session.GetDefaultFolder(olFolderInbox).Parent.Folders
Dim strFolderPath As String
strFolderPath = "Öffentliche Ordner\Alle Öffentlichen Ordner\Kontakte von AS-DA2"
Set myolapp = CreateObject("Outlook.Application")
Set myNamespace = myolapp.GetNamespace("MAPI")
Set colPubCustomersItems = myNamespace.Folders("Öffentliche Ordner").Folders("Alle Öffentlichen Ordner").Folders("Kontakte von
AS-DA2").Items
End Sub
Private Sub colPubCustomersItems_Itemchange(ByVal Item As Object)
Dim objCont As Outlook.ContactItem
Set objCont = Item
Shell "C:\Programme\prog_to run.exe", 0 'vbnormal
End Sub
I am monitoring a public contacts folder (on an exchange server). Every time a contact is changed a program should be launched.
But the event occures even when the contact is only opened. Nothing needs to be changed to let the event fire.
Do I need to take an other event?
My code is below
Thank you very much for your help!!!!
Michael
Public WithEvents colPubCustomersItems As Outlook.Items
Public Sub Application_Startup()
Set objFolders = Session.GetDefaultFolder(olFolderInbox).Parent.Folders
Dim strFolderPath As String
strFolderPath = "Öffentliche Ordner\Alle Öffentlichen Ordner\Kontakte von AS-DA2"
Set myolapp = CreateObject("Outlook.Application")
Set myNamespace = myolapp.GetNamespace("MAPI")
Set colPubCustomersItems = myNamespace.Folders("Öffentliche Ordner").Folders("Alle Öffentlichen Ordner").Folders("Kontakte von
AS-DA2").Items
End Sub
Private Sub colPubCustomersItems_Itemchange(ByVal Item As Object)
Dim objCont As Outlook.ContactItem
Set objCont = Item
Shell "C:\Programme\prog_to run.exe", 0 'vbnormal
End Sub