olMailItem.Save doesn't save change to subject OL2003

  • Thread starter Thread starter Tony Gravagno
  • Start date Start date
T

Tony Gravagno

I have a rule that runs a script which checks for and changes text in
the subject. As an example, it will replace "RE: RE: " with "RE: ".
To save the new subject:
myItem.Subject = newsubject
myItem.Save

I see the save is only partially working. This rule is the first rule
in the set, so after this change is done the item is subjected to many
more rule tests. The item is eventually filtered to some folder. In
the explorer for the destination folder I see the unmodified subject,
but if I Reply or Forward, I sometimes see the modified subject! This
is inconsistent and I'm trying to figure out the pattern.

I guess what I'm missing is insight into the sequence of events and
how they affect the olMailItem. The rule is run, the item is changed,
but it's still in the Inbox. (I can stop the code in debug and
actually see the item in the Inbox with the modified subject.) Other
rules are run, but it seems they run on a copy of the original
instance in memory, not the modified item in the Inbox.

So as we progress from one rule to the next, how do we guarantee that
updated instances of inbound mailitems will be used for subsequent
processing?

Thanks!
Tony
 
I would suggest that you consolidate all of the functionality into the VBA rule "script."
 
I'm sorry Sue, but I don't understand that. I have a rule that
executes a VBA script. That code is exhibiting the behavior described
below. When you say "all of the functionality", do you mean recode
all of my rules as scripts? I have over 120 rules that test for
conditions to eliminate spam and move mail to folders. Sure I can
write a large VBA or com-addin to do the same functionality based on
tables, but I'd really prefer to use the features provided. Also, I'm
providing my code as freeware for others to use - I can't very well
say "you can only use this if you dump all of your existing rules."

If there was a clear guide available as to how Outlook processes
MailItems then I could code to the rules or make a decision about
re-writing everything to accomodate Outlook inconsistencies. I know
you have vast knowledge of the product and I trust your feedback - are
you recommending I just go ahead and put everything into code because
Outlook can't handle this sort of extended manipulation?

If that's the case, I'll put it back to Microsoft - With millions of
users around the world, why are basic components of the software still
buggy like this after so many years?

Many thanks.
Tony
 
Rules have always seemed to work best, at least in my experience, when all the actions you want to take on a particular message are embodied in a single rule. I know of no research or documentation that delves into the issues involved in applying many rules to the same message.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top