Public Folder and userProperty change

  • Thread starter Jeremy van Frank
  • Start date
J

Jeremy van Frank

I have been trying to write in VBA that when a userProperty is changed
in a public folder that a subroutine is run.

One of my views in Outlook has a user defined field (a checkbox) that
I want to monitor for a change in value (checked or unchecked)

I have tried Item_CustomPropertyChange but no joy, ItemChange no joy
as well.

My problem is that I do not want this to be on a form (I don't have
permission to change the organizational form anyway) - just in one
folder in one view for ONE USER - me.

I was able to get the code from slipstick.com to work in VBScript on a
form I generated but I can't get it to work from an Outlook module.

Please help.
 
K

Ken Slovak - [MVP - Outlook]

The Items collection for a folder has a ItemChange event that can be
used to detect any change on an item in that folder. Each item type
such as MailItem has a CustomPropertyChange event that also can be
trapped. To do so you would have to instantiate a new item declared
WithEvents when an item was opened in the NewInspector event.
 
J

Jeremy van Frank

Thanks Ken but I have tried to do what you stated. I would appreciate
sample code if possible so I can see where I am going wrong - and this
is required to go in the 'ThisOutlookSession' correct?

Thanks
 
K

Ken Slovak - [MVP - Outlook]

Yes, the code would be easiest to use from the ThisOutlookSession
class module. Here's a short example.

Dim WithEvents colItems As Outlook.Items

Sub Application_Startup()
Dim oFolder as Outlook.MAPIFolder

Set oFolder = Application.GetNameSpace("MAPI").Folders("Public
Folders")
Set oFolder = oFolders.Folders("All Public
Folders").Folders("MyFolder")
Set colItems = oFolder.Items
End Sub

Sub colFolders_ItemChange(ByVal Item As Object)
'whatever you want to do when an item changes
End Sub

Sub colFolders_ItemAdd(ByVal Item As Object)
'whatever you want to do when an item is added
End Sub




Jeremy van Frank said:
Thanks Ken but I have tried to do what you stated. I would appreciate
sample code if possible so I can see where I am going wrong - and this
is required to go in the 'ThisOutlookSession' correct?

Thanks

"Ken Slovak - [MVP - Outlook]" <[email protected]> wrote in message
The Items collection for a folder has a ItemChange event that can be
used to detect any change on an item in that folder. Each item type
such as MailItem has a CustomPropertyChange event that also can be
trapped. To do so you would have to instantiate a new item declared
WithEvents when an item was opened in the NewInspector event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top