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

What folder does Outlook 2007 use for scripts?



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old June 27th 08, 09:18 PM posted to microsoft.public.outlook.program_vba
High Desert
external usenet poster
 
Posts: 8
Default What folder does Outlook 2007 use for scripts?

On Fri, 27 Jun 2008 15:21:23 -0400, "Sue Mosher [MVP-Outlook]"
wrote:

Outlook doesn't use .vbs scripts with rules. A "run a script" rule action uses not an external script but a VBA procedure with a MailItem or MeetingItem as its parameter. That item 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 Outlook VBA basics, see
http://outlookcode.com/article.aspx?id=49

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.


Thanks for the info and pointers. Guess that I need to do a re-write!
I was so close, so close ....

;-)
 




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
associating scripts to outlook objects gshetty Outlook - General Queries 0 December 3rd 07 04:53 PM
outlook forms scripts אמיר מצס Outlook - Using Forms 10 July 2nd 07 06:30 PM
Outlook express scripts mark Outlook Express 3 February 6th 07 12:12 AM
Any good HOW TO documents for creating custom Outlook scripts [email protected] Outlook and VBA 2 August 18th 06 07:53 PM
Scripts in Outlook teenzbutler Outlook - Using Forms 4 February 22nd 06 02:26 PM


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