troubleshooting Question

Bizarre recipients behavior when click on Send (Outlook 2007 vba)

Avatar of SAbboushi
SAbboushiFlag for United States of America asked on
Visual Basic ClassicOutlookVB Script
20 Comments1 Solution1001 ViewsLast Modified:
Can anyone PLEASE help me understand some of the bizarre behavior I see for the recipients collection?!

When I click on Send, I find that Outlook sets the Recipients.Count property to 0 and the Recipients.Items no longer exist as verified by vba code / watch window / debugger environment during a breakpoint (The 'To' PropertyChange event fires because of this).  But then Outlook adds the Items back to the recipient collection - EVEN WHILE THE CODE IS STILL IN THE BREAKPOINT!

It is like Outlook is doing some housecleaning that I cannot trap using the available Item events.

I have code that needs to run whenever there is a change to the 'To' recipients (I compare the last set of 'To' recipients to the 'To' recipients during a PropertyChange event for the 'To' recipients... but Outlook's housekeeping messes things up (i.e. my code thinks "there has been a change to the 'To' recipients" when it seems to merely be a temporary Outlook housecleaning task).

Basically, I am unable to tell (using vba) whether the 'To' recipients were intentionally deleted from the "To:" box (a valid scenario in which case code is run) vs. Outlook temporarily making it appear as if the 'To' recipients were deleted (in which case I don't want any code to run!)

HELP!!!!  ; )

Thanks--
Sam
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 20 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 20 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros