Thanks, it is working
"Sue Mosher [MVP-Outlook]" wrote in message
...
A macro is, by definition, a public subroutine with no arguments. A "script"
for use with a "run a script" rule needs to have an argument -- a MailItem
or MeetingItem. That item is the item that triggers the rule and is
processed by the code. Here's an example:
Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem
Dim rply as Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
Set rply = msg.Reply
rply.Body = "What you want the reply to say."
rply.To = ;
"
rply.Send
Set msg = Nothing
Set rply = Nothing
Set olNS = Nothing
End Sub
For another example of a "run a script" rule actions, see:
http://www.outlookcode.com/codedetail.aspx?id=1494
CAUTION: Using this technique has been known to result in corrupt VBA code.
Be sure to export your code modules or back up the VBAProject.otm file.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
"Test" wrote in message
...
I did the following steps
1. I wrote a macro under "Tools" and "Macro"
2. Tried "New Rule","Start from a blank Rule", "From People or
Distribution list", "Run a Script"
When I click "Run a Script", I don't see any Scripts there
Please let me know, how to have a "Script"
Thanks