A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

"Run a script" rule triggers but script does not execute



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old April 7th 06, 05:39 PM posted to microsoft.public.outlook.program_vba
Trey Shaffer
external usenet poster
 
Posts: 6
Default "Run a script" rule triggers but script does not execute

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...

--
Trey Shaffer



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem running a VBA script from an Outlook rule Olivier Langlois Outlook and VBA 5 March 16th 06 09:03 PM
Problem running a VBA script from an Outlook rule Olivier Langlois Add-ins for Outlook 5 March 16th 06 09:03 PM
"Outlook requires Window Installer to run" Leo Kerner Outlook - General Queries 0 March 16th 06 07:52 PM
Create rule by script Louis Outlook and VBA 3 March 15th 06 04:49 PM
Script in Rule clarkel Outlook and VBA 2 February 2nd 06 08:20 PM


All times are GMT +1. The time now is 05:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.