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

multiple macro/script in 1 outlook



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 21st 06, 04:32 AM posted to microsoft.public.outlook.program_vba
ah
external usenet poster
 
Posts: 7
Default multiple macro/script in 1 outlook

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  
Old June 21st 06, 04:40 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default multiple macro/script in 1 outlook

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  
Old June 21st 06, 04:43 AM posted to microsoft.public.outlook.program_vba
ah
external usenet poster
 
Posts: 7
Default multiple macro/script in 1 outlook

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  
Old June 21st 06, 06:40 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default multiple macro/script in 1 outlook

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  
Old June 21st 06, 07:52 AM posted to microsoft.public.outlook.program_vba
ah
external usenet poster
 
Posts: 7
Default multiple macro/script in 1 outlook

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  
Old June 21st 06, 06:10 PM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default multiple macro/script in 1 outlook

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  
Old June 22nd 06, 02:54 AM posted to microsoft.public.outlook.program_vba
ah
external usenet poster
 
Posts: 7
Default multiple macro/script in 1 outlook

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  
Old June 22nd 06, 03:04 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default multiple macro/script in 1 outlook

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


All times are GMT +1. The time now is 08:03 PM.


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.