![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 10:03 PM |
Problem running a VBA script from an Outlook rule | Olivier Langlois | Add-ins for Outlook | 5 | March 16th 06 10:03 PM |
"Outlook requires Window Installer to run" | Leo Kerner | Outlook - General Queries | 0 | March 16th 06 08:52 PM |
Create rule by script | Louis | Outlook and VBA | 3 | March 15th 06 05:49 PM |
Script in Rule | clarkel | Outlook and VBA | 2 | February 2nd 06 09:20 PM |