Outlook 2021 'Run Script" Rules?

Status
Not open for further replies.

nurbles

New Member
Outlook version
Outlook 2019 64-bit
Email Account
Outlook.com (as MS Exchange)
[BTW -- I'm sure it is already known that Office 2021 is not an option in the account sign-up, so I lied and picked 2019]

Is there any way to have an Outlook 2021 rule run a script? I've found many examples of doing this, but it appears that the ability to have rules activate scripts was removed several Outlook version ago.

I would like to remove common text from the start of every subject line that my rule is filtering -- the text the rule matches is totally redundant in the destination folder and reduces much of the actual subject to an ellipsis. If there's a way to do that without a script, I'm open to that solution as well!
 
Technically, there is little difference "under the hood" between 2016, 2019, 2021, and 365 - just some new features in the newer versions. But I fixed it. (One of the regulars mentioned it yesterday.)

To use run a script, you need to set a registry key - its the same as for 2016 and newer.
 
Thanks! Now I can see the 'Run a script' item in the rule actions.

Actually getting my script to work is turning out to big much more difficult than I expected, but hopefully I'll get there. Thanks again!
 
OK, I am now able to choose the "Run a script" option for a rule and I created a rule that matches the subject string "Developer Community" that should run this macro:

Public Sub CleanDevSubject(ByRef Item As Outlook.MailItem) Debug.Print Now ' This shows you when the code runs End Sub

Every once in a while, when I try to test run the rule, the time is printed. Most of the time, NOTHING is printed to the immediate window (where the Debug.Print should write.)

So... is there a 'trick' to actually getting a rule to match & activate a script? I have an older rule that matches the exact same subject text that moves the message to a sub-folder and that rule triggers perfectly. So I am at a total loss as to why the 'Run a script' version of the rule seems to rarely ever fire when there is a match.

[EDIT: Should I start a new thread? I figured I'm still asking about a rule running a script, so I continued here...]
 
Never mind, I found the issues.

First, the "stop processing more rules" item is actually processed BEFORE the "Run a script" item, so when both are checked, the script NEVER RUNS. Stupid, but repeatable.

Second, I added lines like these:
Code:
        If 0 <> Err.Number Then
            Debug.Print "ERROR G: [" & CStr(Err.Number) & "] " & Err.Description
            End
        End If
between EVERY LINE of my actual script to find out what was failing and slowly, but surely eliminated the bugs. (I change the 'G:' in each instance of the error print to make them unique (because I don't know how to get the current line number :) .)

So, now my script runs perfectly, both removing the unnecessary common text from all subjects and moving the messages to the appropriate folder. Thanks again for pointing me in the correct direction!
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
V Setting up Outlook 2021 on new computer Using Outlook 2
T How to Export & Import GMAIL Contacts into Outlook 2021 ? Using Outlook 4
T How to get an EVENT COLOR option in Outlook 2021 ? Using Outlook 0
e_a_g_l_e_p_i Need clarification on 2-Step Verification for Gmail using Outlook 2021 Using Outlook 10
L Opening People Outlook 2021 Using Outlook 2
e_a_g_l_e_p_i Outlook 2021 not letting me setup my Gmail using pop Using Outlook 1
e_a_g_l_e_p_i Is it possible to have a reminder in Outlook 2021 for every 90 days Using Outlook 3
H Integrating Alexa & Outlook Pro 2021 Using Outlook 2
U Outlook 2021 not showing contact cards in Searches Using Outlook 1
J Outlook 2021 ScanPST errors (yet again ... sorry): repair button missing Outlook 2021 Using Outlook 5
F Running Scripts in Outlook 2021 Using Outlook 0
e_a_g_l_e_p_i I can't believe what I am seeing when trying to install Outlook 2021 Using Outlook 9
icacream Outlook 2021 - Google calendar in the peek Using Outlook 0
e_a_g_l_e_p_i MY Outlook 2021 changed the format of the shortcuts for mail, calendar etc. Using Outlook 10
e_a_g_l_e_p_i Question about reinstalling Outlook 2021 Using Outlook 5
KurtLass Opening Graphics Attachments in Outlook 2021 Using Outlook 0
J Outlook search bar in Office 2021 Professional Using Outlook 1
S Sync Outlook (2021) tasks with Microsoft To Do Using Outlook 1
S Outlook 2021 How to customize colors Outlook 2021 & Office 2021 on PC Using Outlook 1
D Gmail mail is being delivered to a different email inbox in Outlook App 2021 Using Outlook 2
D Outlook app 2021 & iCloud PST issues Using Outlook 2
A iCloud Outlook Add In is causing Outlook 2021 to crash and got disabled Using Outlook 10
R Outlook 2021 Having problem setting up outlook 2021 with windows 11. I have 3 gmail accounts and I want the 3 gmail, emails to merge into the same outlook input. Using Outlook.com accounts in Outlook 0
e_a_g_l_e_p_i Outlook 2021 all appointments not showing in calendar Using Outlook 2
T Outlook 2021 Cannot open attachments Outlook DeskTop 2021 Using Outlook 0
e_a_g_l_e_p_i Email notifications changed with Outlook 2021 Using Outlook 8
Commodore Any way to create "from-only" account on Outlook 2021? Using Outlook 1
V Outlook 2021 Outlook-2021 (64-bit) and iCloud-for-Windows v13.0 - It Works Good. Using Outlook 12
D Outlook 2016 and Earlier with Office365 in 2021 Using Outlook 3
H Force Outlook 2019 with GMail 2-Step to Require Login? Using Outlook 0
G Retaining Tabs in outlook body Using Outlook 2
G Add Map It button to Custom Contacts Form in Outlook Outlook VBA and Custom Forms 1
X Custom icon (not from Office 365) for a macro in Outlook Outlook VBA and Custom Forms 1
Victor_50 Problem - Google Workspace will stop "unsafe" access to Outlook end 2024 Using Outlook 3
C New pc, new outlook, is it possible to import auto-complete emailaddress Using Outlook 4
T Outlook 365 won't take new working password Using Outlook 0
S Create Outlook Task from Template and append Body with Email Body Outlook VBA and Custom Forms 4
P Can't add custom field to custom Outlook form, it always adds to the Folder instead Outlook VBA and Custom Forms 2
B Sync Outlook Public Folders to Contacts Using Outlook 2
D Delete Outlook emails from MS server Using Outlook 9
B Outlook tasks and PDF Using Outlook 4
D Outlook 2019 is no longer asking for password ... Using Outlook 5
Kika Melo How to mark as Junk any message not from Contacts (in Outlook.com) Using Outlook 3
L Outlook attachments from OneDrive as links Using Outlook 0
G Outlook 365 My iCloud Outlook doesn’t work after reinstalling Microsoft365 on Windows 10 PC – now I get error message on contacts and calendar Using Outlook 1
M Synchronization and backup of Outlook from local to server. Using Outlook 8
K How can I delete an e-mail from Outlook Using Outlook 1
V Outlook Error The Attempted operation Failed. An Object Could Not be found Outlook VBA and Custom Forms 0
P Yahoo/IMAP folder rename by Outlook desktop 365 Using Outlook 0
A Outlook 2019 folder counter Using Outlook 0

Similar threads

Back
Top