T
Trey Shaffer
I am attempting to use the "Run a script" action in an Outlook 2003 rule.
The script contents appears to be valid, with the requisite MailItem. The
subroutines are recognized, and selectable, in the Rules Wizard. Code
below...
The rule is being triggered. If I add some other built in action action,
Play a Sound, etc., to the rule, it occurs.
Following are two code bits. The first is from Sue Mosher. The second is
just a minimalist fragment to produce a visible result, the MsgBox. Niether
one produces the expected message box.
Fragment 1 _________________________________________
Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.Body
Set olMail = Nothing
Set olNS = Nothing
End Sub
Fragment 2 __________________________________________
Sub Test(objMyMail As MailItem)
MsgBox "Hello World"
End Sub
Your help appreciated...
The script contents appears to be valid, with the requisite MailItem. The
subroutines are recognized, and selectable, in the Rules Wizard. Code
below...
The rule is being triggered. If I add some other built in action action,
Play a Sound, etc., to the rule, it occurs.
Following are two code bits. The first is from Sue Mosher. The second is
just a minimalist fragment to produce a visible result, the MsgBox. Niether
one produces the expected message box.
Fragment 1 _________________________________________
Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.Body
Set olMail = Nothing
Set olNS = Nothing
End Sub
Fragment 2 __________________________________________
Sub Test(objMyMail As MailItem)
MsgBox "Hello World"
End Sub
Your help appreciated...