Run script rule not exectued for first few mails

  • Thread starter Thread starter Luc
  • Start date Start date
L

Luc

I recently replaced a number of rules for routing incoming mails to
different folders by a single 'run script' rule, and wrote a more refined
version of the filters in VBA (in O2007).

Now, every morning when I start up outlook, the script is skipped for the
first handful of mails that are already waiting at the mail server (mails
are downloaded to personal folders, the script routes them to different
folders there).

When I start the script manually (tools / rules / run rules now), it moves
the mails to the right folders, and from then on everything works as
expected -- until the next day when I launch Outlook.


So what I think this means is that there's some kind of delay after Outlook
is started, before VBA begins to work. The rule is still executed for
later mails, also if I don't start it manually, but the first handful
always remain in my inbox.


Does anyone know more about this, and maybe a solution or a workaround?
Some way to delay collecting mail for 10-15 seconds after Outlook is
started should do the trick, I think.
 
Some way to delay collecting mail for 10-15 seconds after Outlook is
started should do the trick, I think.

I think I just /may/ have thought of a solution, but as there are no mails
waiting on the server when I start Outlook now, I'll have to wait until
monday to see if it works.

The solution would be to create an Application_Startup script with just
some dummy code that doesn't really do anything, except being there.


For testing I put a MsgBox in it.

It looks like it is executed at startup before Outlook connects to the
server. I sent a test mail to myself and then immediately closed Outlook,
before it could arrive. Then restarted Outlook, the mail arrived only after
I closed the messagebox, and the filter script correctly ran on it.

If this still works on Monday, I'm going to try replacing the message box
by something that doesn't require interaction.
 
After trying it out for two days: this works indeed. Just put some code in
the Application Startup event - anything at all, I think - and the incoming
mail rule/script will run for every mail from the first one on.

No code in the Startup event, and the script is skipped for the first few
mails that arrive immediately after Outlook is launched.
 
Back
Top