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

Create Outlook - Script



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 19th 08, 06:28 PM posted to microsoft.public.outlook.program_vba
Test
external usenet poster
 
Posts: 9
Default Create Outlook - Script

I did the following steps



1. I wrote a macro under "Tools" and "Macro"




2. Tried "New Rule","Start from a blank Rule", "From People or


Distribution list", "Run a Script"




When I click "Run a Script", I don't see any Scripts there






Please let me know, how to have a "Script"




Thanks





  #2  
Old June 19th 08, 06:32 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Create Outlook - Script

A macro is, by definition, a public subroutine with no arguments. A "script" for use with a "run a script" rule needs to have an argument -- a MailItem or MeetingItem. That item is the item that triggers the rule and is processed by the code. Here's an example:


Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem
Dim rply as Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
Set rply = msg.Reply
rply.Body = "What you want the reply to say."
rply.To = ; "
rply.Send

Set msg = Nothing
Set rply = Nothing
Set olNS = Nothing
End Sub

For another example of a "run a script" rule actions, see:

http://www.outlookcode.com/codedetail.aspx?id=1494

CAUTION: Using this technique has been known to result in corrupt VBA code. Be sure to export your code modules or back up the VBAProject.otm file.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Test" wrote in message ...
I did the following steps




1. I wrote a macro under "Tools" and "Macro"




2. Tried "New Rule","Start from a blank Rule", "From People or


Distribution list", "Run a Script"




When I click "Run a Script", I don't see any Scripts there






Please let me know, how to have a "Script"




Thanks





  #3  
Old June 19th 08, 06:47 PM posted to microsoft.public.outlook.program_vba
Test
external usenet poster
 
Posts: 9
Default Create Outlook - Script

Thanks, it is working

"Sue Mosher [MVP-Outlook]" wrote in message
...
A macro is, by definition, a public subroutine with no arguments. A "script"
for use with a "run a script" rule needs to have an argument -- a MailItem
or MeetingItem. That item is the item that triggers the rule and is
processed by the code. Here's an example:


Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem
Dim rply as Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
Set rply = msg.Reply
rply.Body = "What you want the reply to say."
rply.To = ; "
rply.Send

Set msg = Nothing
Set rply = Nothing
Set olNS = Nothing
End Sub

For another example of a "run a script" rule actions, see:

http://www.outlookcode.com/codedetail.aspx?id=1494

CAUTION: Using this technique has been known to result in corrupt VBA code.
Be sure to export your code modules or back up the VBAProject.otm file.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Test" wrote in message
...
I did the following steps




1. I wrote a macro under "Tools" and "Macro"




2. Tried "New Rule","Start from a blank Rule", "From People or


Distribution list", "Run a Script"




When I click "Run a Script", I don't see any Scripts there






Please let me know, how to have a "Script"




Thanks







 




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
Create Outlook - Script Test Outlook - General Queries 0 June 19th 08 06:17 PM
Outlook Script: How to create / delete txt file bbnimda Outlook - Using Forms 6 February 15th 08 01:08 PM
Create Folder in Outlook 2003 with GPO or script? kc2kth Outlook - Installation 1 March 29th 07 12:05 AM
Create IMAP account in Outlook using Logon Script Karnifexx Outlook - General Queries 1 January 24th 07 01:18 PM
Outlook 2003 Script: How to create an Id for task news.microsoft.com Outlook and VBA 6 October 20th 06 10:16 PM


All times are GMT +1. The time now is 10:41 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.