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



Ads
  #2  
Old April 7th 06, 05:41 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default "Run a script" rule triggers but script does not execute

Does other VBA code run? What is your setting in Tools | Macro Security?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Trey Shaffer" wrote in message ...
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



  #3  
Old April 7th 06, 06:49 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

Yes, Macro Security setting was "High." Changed to "Low" and code ran...
I'm guessing I can use the SelfCert.exe to put a signature on this when I'm
ready to deploy it...

Thanks Sue

"Sue Mosher [MVP-Outlook]" wrote in message
...
Does other VBA code run? What is your setting in Tools | Macro Security?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Trey Shaffer" wrote in message
...
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





  #4  
Old April 7th 06, 07:32 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default "Run a script" rule triggers but script does not execute

Deploy it? You realize that Outlook VBA code was never designed to be deployed to other people, right?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Trey Shaffer" wrote in message ...
Yes, Macro Security setting was "High." Changed to "Low" and code ran...
I'm guessing I can use the SelfCert.exe to put a signature on this when I'm
ready to deploy it...

Thanks Sue

"Sue Mosher [MVP-Outlook]" wrote in message
...
Does other VBA code run? What is your setting in Tools | Macro Security?



"Trey Shaffer" wrote in message
...
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





  #5  
Old April 7th 06, 08:38 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

Perhaps I should have said, "Install it on the two workstations that will
use it."


"Sue Mosher [MVP-Outlook]" wrote in message
...
Deploy it? You realize that Outlook VBA code was never designed to be
deployed to other people, right?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Trey Shaffer" wrote in message
...
Yes, Macro Security setting was "High." Changed to "Low" and code ran...
I'm guessing I can use the SelfCert.exe to put a signature on this when
I'm
ready to deploy it...

Thanks Sue

"Sue Mosher [MVP-Outlook]" wrote in message
...
Does other VBA code run? What is your setting in Tools | Macro Security?



"Trey Shaffer" wrote in message
...
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







  #6  
Old April 7th 06, 08:49 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default "Run a script" rule triggers but script does not execute

As long as you understand that there's no way to do that short of export/import and the VBA code project, especially when you're using rules to run procedures, can become corrupted, we'll feel you've been fairly warned.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Trey Shaffer" wrote in message ...
Perhaps I should have said, "Install it on the two workstations that will
use it."


"Sue Mosher [MVP-Outlook]" wrote in message
...
Deploy it? You realize that Outlook VBA code was never designed to be
deployed to other people, right?

"Trey Shaffer" wrote in message
...
Yes, Macro Security setting was "High." Changed to "Low" and code ran...
I'm guessing I can use the SelfCert.exe to put a signature on this when
I'm
ready to deploy it...

Thanks Sue

"Sue Mosher [MVP-Outlook]" wrote in message
...
Does other VBA code run? What is your setting in Tools | Macro Security?



"Trey Shaffer" wrote in message
...
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







  #7  
Old April 7th 06, 11:00 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

When someone tells me something will work, I always hope their right and
test it. When someone tells me something won't work, I usually take that at
face value.

I am familiar with the module export/import process, and it seems functional
for limited, manual distribution. I guess my concern is more with the
second part of your statement about corruption. I was planning to run this
rule/process on a"lights-out" machine. The function is not mission
critical, but a few people would say it is important to their job function.

Any more suggestions or war stories you would care to share?




"Sue Mosher [MVP-Outlook]" wrote in message
...
As long as you understand that there's no way to do that short of
export/import and the VBA code project, especially when you're using rules
to run procedures, can become corrupted, we'll feel you've been fairly
warned.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Trey Shaffer" wrote in message
...
Perhaps I should have said, "Install it on the two workstations that will
use it."


"Sue Mosher [MVP-Outlook]" wrote in message
...
Deploy it? You realize that Outlook VBA code was never designed to be
deployed to other people, right?

"Trey Shaffer" wrote in message
...
Yes, Macro Security setting was "High." Changed to "Low" and code ran...
I'm guessing I can use the SelfCert.exe to put a signature on this when
I'm
ready to deploy it...

Thanks Sue

"Sue Mosher [MVP-Outlook]" wrote in message
...
Does other VBA code run? What is your setting in Tools | Macro Security?



"Trey Shaffer" wrote in message
...
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









  #8  
Old April 7th 06, 11:34 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default "Run a script" rule triggers but script does not execute

I have myself seen a VBAProject.otm file go belly-up while running a "run from script" rule and have fielded a couple of reports from others who have also seen that happen. The VBAProject.otm files in question were unrecoverable. Moral of the story: Keep backups.

Outlook is not really designed to run any kind of code in an unattended environment. As a client application, there are just too many scenarios where execution could be blocked by modal UI that Outlook displays. So, you'll certainly want to keep a close eye on any such machine. And, in the long run, you might want to consider other ways of accomplishing the same goal (whatever that is).

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Trey Shaffer" wrote in message ...
When someone tells me something will work, I always hope their right and
test it. When someone tells me something won't work, I usually take that at
face value.

I am familiar with the module export/import process, and it seems functional
for limited, manual distribution. I guess my concern is more with the
second part of your statement about corruption. I was planning to run this
rule/process on a"lights-out" machine. The function is not mission
critical, but a few people would say it is important to their job function.

Any more suggestions or war stories you would care to share?




"Sue Mosher [MVP-Outlook]" wrote in message
...
As long as you understand that there's no way to do that short of
export/import and the VBA code project, especially when you're using rules
to run procedures, can become corrupted, we'll feel you've been fairly
warned.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Trey Shaffer" wrote in message
...
Perhaps I should have said, "Install it on the two workstations that will
use it."


"Sue Mosher [MVP-Outlook]" wrote in message
...
Deploy it? You realize that Outlook VBA code was never designed to be
deployed to other people, right?

"Trey Shaffer" wrote in message
...
Yes, Macro Security setting was "High." Changed to "Low" and code ran...
I'm guessing I can use the SelfCert.exe to put a signature on this when
I'm
ready to deploy it...


 




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 11:28 PM.


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