Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Script Rule option disapperared after office upgade

Tags:

vba

outlook

I had a simple but very important vba rule in Outlook.

This morning my Office upgraded to 16.0.7531.1003 version (64 bit) and I found my rule unchecked and trying to check it I get message "This rule is unavailable in current mode" (this is a translation as I am not using English version of Outlook).

Furthermore, the option "run script" is no longer visible while trying to configure a new rule.

The only thing the rule does is searching new email body for valid GUID, and if any exists, it inserts the GUID and email SentOn date into database.
Did Microsoft disable VBA rules at all?

Public Sub getGUID(receiptItem As MailItem)
Dim regE As New RegExp
Dim matches As MatchCollection
Dim sql As String: sql = "insert HDSDEB.dbo.ReportCalendar_received(ReportGUID, SentDatetime) values ('__GUID__', '__SentOn__');"

regE.Pattern = "[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}"
regE.IgnoreCase = True
regE.MultiLine = True
Set matches = regE.Execute(receiptItem.body)

If matches.Count = 0 Then Exit Sub
Debug.Print matches.Item(0).Value

sql = Replace(sql, "__GUID__", matches.Item(0).Value)
sql = Replace(sql, "__SentOn__", receiptItem.SentOn)

SQLQueryRun (sql)
Debug.Print sql
End Sub
like image 942
avb Avatar asked Dec 05 '25 11:12

avb


1 Answers

I had the same issue like yours and this post may be what you need. Adding a new value to my computer's registry (EnableUnsafeClientMailRules) and set it to 1 solved my problem.

like image 108
hsy9045 Avatar answered Dec 09 '25 06:12

hsy9045