WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

What folder does Outlook 2007 use for scripts?

 
   Home -> Office -> Programming VBA RSS
Next:  Problem with a custom task form  
Author Message
High Desert

External


Since: Mar 28, 2007
Posts: 8



(Msg. 1) Posted: Fri Jun 27, 2008 12:01 pm
Post subject: What folder does Outlook 2007 use for scripts?
Archived from groups: microsoft>public>outlook>program_vba (more info?)

I have a script (.vbs) which I wish to run upon receiving certain
messages. What is the default directory path in which to place the
script so that I may invoke it with a rule?

Thanks!
Back to top
Login to vote
Sue Mosher [MVP-Outlook]

External


Since: Feb 11, 2005
Posts: 22921



(Msg. 2) Posted: Fri Jun 27, 2008 3:21 pm
Post subject: Re: What folder does Outlook 2007 use for scripts? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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 = "who@where.com; who2.RemoveThis@where2.com"
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.


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


"High Desert" <do_not_use.RemoveThis@sbcglobal.net> wrote in message news:26ea64pjoo1llajl0irpsnfa79ns8mvr85@4ax.com...
>I have a script (.vbs) which I wish to run upon receiving certain
> messages. What is the default directory path in which to place the
> script so that I may invoke it with a rule?
>
> Thanks!
Back to top
Login to vote
High Desert

External


Since: Mar 28, 2007
Posts: 8



(Msg. 3) Posted: Fri Jun 27, 2008 3:21 pm
Post subject: Re: What folder does Outlook 2007 use for scripts? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 27 Jun 2008 15:21:23 -0400, "Sue Mosher [MVP-Outlook]"
<suemvp.RemoveThis@outlookcode.com> 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 = "who@where.com; who2.RemoveThis@where2.com"
> 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 ....

Wink
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET