N
N
newvasyuki2021-01-19 13:11:27
Visual Basic
newvasyuki, 2021-01-19 13:11:27

Problem with VBA macro due to email processing rules in Outlook, how to make friends with them?

Outlook 2019 has a macro that handles the inbox event. The macro checks the subject of the incoming email, and if it matches the template, the user is asked to open the email, which, if confirmed, is opened via the Display method of the MailItem object. The problem is that the rules for sorting incoming mail are also configured, which in the background move letters to subfolders, as a result of which the Display method crashes with an error (when the letter is obviously moved)

6006afa473842169561212.jpeg

How to make rules and a macro fit together? How to correctly open a letter processed in a macro via Display?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
newvasyuki, 2021-01-22
@newvasyuki

I decided this way: I enabled the ability to run a macro in the rules (disabled by default starting from outlook 2013, you need to tweak the registry) and hung a macro (s) on the rule.

B
BasiC2k, 2021-01-19
@BasiC2k

Options:
1. Set the macro to handle new messages in subfolders (except for Inbox);
2. Scatter incoming letters into subfolders with a macro;
3. Disable the rules and enable them with a macro at the end of its work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question