Outlook 2010 - using a VBA script in a rule

4

I was following the directions in a great post when I got to the step for selecting the name of the script to run. I have VB code in ThisOutlookSession, but for some reason, the name of the procedure does not appear in the "Select Script" box. I can step through the code in debug mode, so it seems to be syntactically correct. What can be causing it to hide?

Mark

Posted 2012-09-13T00:11:05.853

Reputation: 41

Answers

3

You probably have the wrong parameters in the script. Are you just passing in a MailItem? e.g.

Public Sub MacroName(email As MailItem)
    ' Your code here
End Sub

Once you've compiled it (Debug|Compile), it should show up in Outlook rules as an option. Note that if the parameters are wrong (i.e. you don't pass in just a MailItem) then it won't appear.

Rhys Gibson

Posted 2012-09-13T00:11:05.853

Reputation: 4 218

1in the vba editor open the ThisOutlookSession and create a Public sub as rhys mentioned. inside the sub goes your code. make sure to put a proper end on the sub as well. after the code is developed then one of the menu's has a compile and run option. once it is compiled it will show up in outlook as an option. Im assuming you are trying to use it in a rule. if so after the script is compiled it will be available in the custom script action in rules. – Kendrick – 2012-09-13T01:50:04.340