Why can't I create a Rules Wizard rule to execute menu commands? For example, when I get a message in HTML format, I'd like to use a rule to change that message to plain text.
If you have Microsoft Office Outlook 2003 or Outlook 2002, you can execute a menu command with a rule. Those versions of Outlook support a run a script rule action (a misnomer, because that option runs not an external script but a Visual Basic for Applications—VBA—procedure structured in a certain way). You can execute any menu command by using techniques related to the CommandBars object. (Listing 2 in "Creating a Custom Pop-Up Box," May 2002, InstantDoc ID 24461, provides an example.)
However, often there's a more direct way to accomplish the goal that doesn't involve executing a menu command. Listing 1 shows a rule "script" that uses the BodyFormat property to detect and change the message format. Notice how the subroutine's declaration includes a MailItem object (i.e., a message) as an argument. Any VBA subroutine that has a MailItem object as an argument is available to the run a script rule action.