![]() |
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
|
|||
|
|||
![]()
Can I have more than 1 script running in 1 outlook mailbox?
I've created a script as follows previously: Sub RunAScriptRuleRoutine(MyMail As MailItem) Dim strID As String Dim olNS As Outlook.NameSpace Dim msg As Outlook.MailItem Dim rpl As Outlook.MailItem strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set msg = olNS.GetItemFromID(strID) ' do stuff with msg, e.g. Set rpl = msg.Reply rpl.Body = "testing" & vbCrLf & rpl.Body rpl.Subject = "Authorization fail" rpl.Send Set msg = Nothing Set olNS = Nothing End Sub Sub test() End Sub The above script should be run when the e-mail was sent by those unauthorized personnel. Now, I wish to run another script to generate an auto reply e-mail to the authorized personnel with another message, for example: Thanks for your e-mail etc. But, I found that I can only put in 1 script in the macro. Kindly advice me on how to resolve this issue. Thanks in advance |
Ads |
#2
|
|||
|
|||
![]()
Create a second macro or, better yet, consolidate your code into a single procedure.
-- 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 "ah" wrote in message ... Can I have more than 1 script running in 1 outlook mailbox? I've created a script as follows previously: Sub RunAScriptRuleRoutine(MyMail As MailItem) Dim strID As String Dim olNS As Outlook.NameSpace Dim msg As Outlook.MailItem Dim rpl As Outlook.MailItem strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set msg = olNS.GetItemFromID(strID) ' do stuff with msg, e.g. Set rpl = msg.Reply rpl.Body = "testing" & vbCrLf & rpl.Body rpl.Subject = "Authorization fail" rpl.Send Set msg = Nothing Set olNS = Nothing End Sub Sub test() End Sub The above script should be run when the e-mail was sent by those unauthorized personnel. Now, I wish to run another script to generate an auto reply e-mail to the authorized personnel with another message, for example: Thanks for your e-mail etc. But, I found that I can only put in 1 script in the macro. Kindly advice me on how to resolve this issue. Thanks in advance |
#3
|
|||
|
|||
![]()
And I think I've left out something in my previous message
In fact, I wish to get the following result: 1. Run rules when I receive mail 2. Send an auto reject mail and move the message to a "reject" folder when I receive the mail from those sender's address that contain "abc". 3. Send an auto reply mail when I receive mail from someone in my address book Thanks. |
#4
|
|||
|
|||
![]()
Am Tue, 20 Jun 2006 19:43:01 -0700 schrieb ah:
You can e.g. add that into the existing macro. Check the sender address and use an If ... Then ... Else -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.VBOffice.net -- And I think I've left out something in my previous message In fact, I wish to get the following result: 1. Run rules when I receive mail 2. Send an auto reject mail and move the message to a "reject" folder when I receive the mail from those sender's address that contain "abc". 3. Send an auto reply mail when I receive mail from someone in my address book Thanks. |
#5
|
|||
|
|||
![]()
Hi;
Can you help me on this? I get errors when I add in the code myself. My original script is as follows: Sub RunAScriptRuleRoutine(MyMail As MailItem) Dim strID As String Dim olNS As Outlook.NameSpace Dim msg As Outlook.MailItem Dim rpl As Outlook.MailItem strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set msg = olNS.GetItemFromID(strID) ' do stuff with msg, e.g. Set rpl = msg.Reply rpl.Body = "testing" & vbCrLf & rpl.Body rpl.Subject = "Authorization fail" rpl.Send Set msg = Nothing Set olNS = Nothing End Sub Sub test() End Sub Can you guide me on how to add in those code? "Michael Bauer" wrote: Am Tue, 20 Jun 2006 19:43:01 -0700 schrieb ah: You can e.g. add that into the existing macro. Check the sender address and use an If ... Then ... Else -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.VBOffice.net -- And I think I've left out something in my previous message In fact, I wish to get the following result: 1. Run rules when I receive mail 2. Send an auto reject mail and move the message to a "reject" folder when I receive the mail from those sender's address that contain "abc". 3. Send an auto reply mail when I receive mail from someone in my address book Thanks. |
#6
|
|||
|
|||
![]()
Am Tue, 20 Jun 2006 22:52:01 -0700 schrieb ah:
Please show us what you have added. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.VBOffice.net -- Hi; Can you help me on this? I get errors when I add in the code myself. My original script is as follows: Sub RunAScriptRuleRoutine(MyMail As MailItem) Dim strID As String Dim olNS As Outlook.NameSpace Dim msg As Outlook.MailItem Dim rpl As Outlook.MailItem strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set msg = olNS.GetItemFromID(strID) ' do stuff with msg, e.g. Set rpl = msg.Reply rpl.Body = "testing" & vbCrLf & rpl.Body rpl.Subject = "Authorization fail" rpl.Send Set msg = Nothing Set olNS = Nothing End Sub Sub test() End Sub Can you guide me on how to add in those code? "Michael Bauer" wrote: Am Tue, 20 Jun 2006 19:43:01 -0700 schrieb ah: You can e.g. add that into the existing macro. Check the sender address and use an If ... Then ... Else -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.VBOffice.net -- And I think I've left out something in my previous message In fact, I wish to get the following result: 1. Run rules when I receive mail 2. Send an auto reject mail and move the message to a "reject" folder when I receive the mail from those sender's address that contain "abc". 3. Send an auto reply mail when I receive mail from someone in my address book Thanks. |
#7
|
|||
|
|||
![]()
Yup, I manage to have 2 scripts , but I'm facing problem in setting the
rules. The rule that I've set is as follows: 1. Apply the rules when message arrives 2. run the auto notification script when sender is in specific address book The above seems to work well, as it manages to send out an auto notification e-mail to the sender if they are in my address book. Can you please advice me how to set a rules to perform the following: 1. If the sender is not in my address book, run the 2nd script, i.e the auto reject script Thanks "Sue Mosher [MVP-Outlook]" wrote: Create a second macro or, better yet, consolidate your code into a single procedure. -- 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 "ah" wrote in message ... Can I have more than 1 script running in 1 outlook mailbox? I've created a script as follows previously: Sub RunAScriptRuleRoutine(MyMail As MailItem) Dim strID As String Dim olNS As Outlook.NameSpace Dim msg As Outlook.MailItem Dim rpl As Outlook.MailItem strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set msg = olNS.GetItemFromID(strID) ' do stuff with msg, e.g. Set rpl = msg.Reply rpl.Body = "testing" & vbCrLf & rpl.Body rpl.Subject = "Authorization fail" rpl.Send Set msg = Nothing Set olNS = Nothing End Sub Sub test() End Sub The above script should be run when the e-mail was sent by those unauthorized personnel. Now, I wish to run another script to generate an auto reply e-mail to the authorized personnel with another message, for example: Thanks for your e-mail etc. But, I found that I can only put in 1 script in the macro. Kindly advice me on how to resolve this issue. Thanks in advance |
#8
|
|||
|
|||
![]()
Create a rule with no conditions, a "run a script" action, and an exception -- except if sender is in my address book.
-- 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 "ah" wrote in message ... Yup, I manage to have 2 scripts , but I'm facing problem in setting the rules. The rule that I've set is as follows: 1. Apply the rules when message arrives 2. run the auto notification script when sender is in specific address book The above seems to work well, as it manages to send out an auto notification e-mail to the sender if they are in my address book. Can you please advice me how to set a rules to perform the following: 1. If the sender is not in my address book, run the 2nd script, i.e the auto reject script Thanks "Sue Mosher [MVP-Outlook]" wrote: Create a second macro or, better yet, consolidate your code into a single procedure. -- 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 "ah" wrote in message ... Can I have more than 1 script running in 1 outlook mailbox? I've created a script as follows previously: Sub RunAScriptRuleRoutine(MyMail As MailItem) Dim strID As String Dim olNS As Outlook.NameSpace Dim msg As Outlook.MailItem Dim rpl As Outlook.MailItem strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set msg = olNS.GetItemFromID(strID) ' do stuff with msg, e.g. Set rpl = msg.Reply rpl.Body = "testing" & vbCrLf & rpl.Body rpl.Subject = "Authorization fail" rpl.Send Set msg = Nothing Set olNS = Nothing End Sub Sub test() End Sub The above script should be run when the e-mail was sent by those unauthorized personnel. Now, I wish to run another script to generate an auto reply e-mail to the authorized personnel with another message, for example: Thanks for your e-mail etc. But, I found that I can only put in 1 script in the macro. Kindly advice me on how to resolve this issue. Thanks in advance |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
script/macro to send auto reply to sender | ah | Outlook and VBA | 6 | June 22nd 06 05:21 PM |
Rule 'run a script' not running my script | [email protected] | Outlook and VBA | 3 | May 30th 06 01:09 PM |
How do I create multiple VCards from Contacts, using a Macro? | LA | Outlook and VBA | 0 | May 22nd 06 08:35 PM |
script the save of multiple attachments with the same name! | sumGirl | Outlook - General Queries | 1 | April 28th 06 11:03 AM |
"Run a script" rule triggers but script does not execute | Trey Shaffer | Outlook and VBA | 7 | April 8th 06 12:34 AM |