Macro to detect that something has changed or is changing


Erwin Ahlers

I have several PST files in use and would like to detect via VBA that
one of these files is changed. Change mean anything in this file has
changed, e.g. a folder created/deleted/renamed or an item in a folder
created/deleted/changed. At the moment I see no way to detect that
something has changed since the last time I checked. So it seems I
have to react to several events to detect that something changed now
and remember this state. But do I really have to create specific event
handler for each folder in outlook? Even I would have to create one
instance per folder (and even subfolder)? Attaching the same handler
instance to several folder is not supported, right?

Would be great to get some help.



Ken Slovak

That is correct. You would need to handle Add, Remove and Change events for
every folder's Items collection as well as all other relevant events for
folders and stores and subfolders and so on.

In VBA you won't be able to share event handlers as the handlers are tied to
a specific declared object declared WithEvents. In a managed code language
you could share event handlers but you'd need to figure out what fired the

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