Outlook Rules VBA Run a Script - Multiple Rules

Not open for further replies.


New Member
Outlook version
Outlook 2010 64 bit
Email Account
How can I have multiple 'scripts' available to run multiple rules? The only code that appears available to run with Rules/run a script..is the code pasted in ThisOutlookSession. The modules below do not appear.

I have Outlook 2010 on windows 11. I'm accounts payable for my company. All my invoices (many!) come in my email.

What I'm trying to do: I have many vendors, I want to create rules that will automatically save the attachments from specific vendors to the correct folder. I want to be able to set a rule to save attachments that come from joeshmo's email to the joeshmo folder in My Documents.

What I CAN do: I have a couple working codes:

  1. I have a code where i can select emails, run the macro and all attachments are saved to the same folder.
  2. I have a code that i can use in a rule.
I did have to re-enable scripts for my version of outlook.

So I go to Rules, I set conditions, choose "run a script" and in the drop down, only 1 code is available to run, and that is whatever is pasted into "ThisOutlookSession". When I open visual basic, there is a list of Modules but none of them appear in Run a script. Nor can I move them up there. I can only paste one code. Below is an example of the code.

I wanted to create a Rule and accompanying script per Vendor to run automatically. So all the incoming emails with invoices are automatically saved to their folder.

Am i asking too much? i can save all attachments to the same folder and then sort. Or I can create rules to assign categories to each vendors email and then sort alphabetically...meaning, I can select all the "A" vendors, run the macro, Select the "B" vendors, etc.

Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat
dateFormat = Format(Now, "yyyy-mm-dd H-mm")
saveFolder = "C:\Users\jenny\Documents\Attachments\outlook testing\test number one"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & dateFormat & objAtt.DisplayName
Set objAtt = Nothing
End Sub

Any ideas? thanks
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Outlook 2007 Rules & VBA: How to run a script on a report message (ReportItem) Using Outlook 14
N Outlook 2021 'Run Script" Rules? Outlook VBA and Custom Forms 4
A Apply Selected Emails to outlook rules and Run Rules Using Outlook 5
Wayne Outlook locks up when opening "Manage Rules & Alerts" Using Outlook 7
T "Words In Recipient's Address" Rule Causes Outlook To Stop Processing Rules Using Outlook 3
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
K Outlook Rules: Move a Copy Using Outlook 4
soadfan Outlook rules look up display name only Using Outlook 4
Justo Horrillo Issue with rules in Outlook 2010 Using Outlook 4
J Outlook Rules - Changing auto-submit address in multiple rules, according to rule name Outlook VBA and Custom Forms 0
E Outlook 2010 need help with rules Using Outlook 0
D Outlook Rules Using Outlook 1
Gunny NFOhiway Outlook PST file and Rules Using Outlook 1
M Outlook 2016 Rules Not Working Automatically Using Outlook 5
oliv- How to Run a Script IN AN ADDIN with Outlook's Rules and Alerts Outlook VBA and Custom Forms 2
Q Outlook 2016\365 export specific rules to import in another system Exchange Server Administration 1
A outlook 2007 how to chcek all rules ? Outlook VBA and Custom Forms 2
J Outlook Rules not show Master Category List Using Outlook.com accounts in Outlook 4
R Outlook rules Using Outlook 3
M Outlook 2007 IMAP Account Rules Issues Using Outlook 3
D Outlook Rules - How to use a variable in the subject condition Outlook VBA and Custom Forms 9
A Setting RULES with more than one condition in MS OUTLOOK Using Outlook 6
J Outlook rules and alternatives Using Outlook 2
Rupert Dragwater How to delete old rules and create new in Outlook 2013 Using Outlook 12
H Using Outlook Rules to search for NewLines in message body Using Outlook 1
R Outlook - alternatives to Rules / Junk? Using Outlook 5
R Outlook 2013 - IMAP & Rules Broken Using Outlook 1
D Trying to repair Outlook rules Using Outlook 5
V Importing Rules in Outlook 2013 Using Outlook 2
T Adding text to forwarding rules in Outlook 2010 Using Outlook 1
T Adding tex to forwarding rules in Outlook 2010 Exchange Server Administration 1
D Outlook 2010 Rules: fwd meeting invitation results in winmail.dat not .ics Using Outlook 4
M Outlook 2010 IMAP rules occasionaly stop working Using Outlook 4
kburrows Smartphones, Outlook and Rules Using Outlook 0
W Fwd Outlook incomming messages to usb port after Rules and alerts applied Using Outlook 0
P Outlook 2013 rules -- not working reliably -- moving messages to wrong boxes Using Outlook 0
J Outlook 2013 - Rules and Alerts for POP3/IMAP Accounts Using Outlook 1
S Outlook 2010: Message Rules come back next time I restart Outlook Using Outlook 0
D Unable to transfer rules from one Outlook computer to another Using Outlook 5
R Outlook 2013 Rules not working Using Outlook 1
S Outlook 2013 - All rules simply delete the email Using Outlook 1
M Rules in Outlook 2013 Exchange Server Administration 9
K Outlook Cached Mode - can't create rules to move email to another mailbox Using Outlook 2
J Outlook rules help Using Outlook 1
D Outlook Rules Using Outlook 1
J Outlook - rules and Alerts Using Outlook 1
V Outlook 2010 non working rules Using Outlook 1
M Rules & Alerts not appearing in the File Tab (outlook 2010) Using Outlook 1
S Outlook 2010, need script for rules & Warnings Using Outlook 3
J Outlook - rules and Alerts - from group Using Outlook 3

Similar threads