Outlook 2002 Rules Wizard

C

Conan Kelly

Hello all,

In Outlook 2002's Rules Wizard's "What do you want to do with the message?" list, I notice a "run a script" option. When I select
this option, there are no scripts listed in the Select Script dialog box.

Is this something that can only be used in conjunction with MS Exchange? If not, how do I create scripts and where do I store them?

Thanks for any help anyone can provide,

Conan Kelly
 
S

Sue Mosher [MVP-Outlook]

No, it's something that can be used in conjunction with OUtlook VBA. A "run a script" rule action actually uses not an external script but a VBA procedure with a MailItem or MeetingItem as its parameter. That item is processed by the code:


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

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
MsgBox msg.SUbject

Set msg = Nothing
Set olNS = Nothing
End Sub

See http://www.outlookcode.com/d/code/zaphtml.htm#ol2002 for another example.


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
C

Conan Kelly

Sue,

Thank you so much for your help. I will try this out and see if it will work for me.

What I'm trying to do is set up a script that will automatically forward an incoming email sent with a custom email form to a
standard email form filling in the To, Subject, and Message Body fields with the values that are in different custom fields from the
custom form. I'm still working on the design of the form, but if any body has any example code to get me started, I would
appreciated very much. I can probably figure it out on my own, but if some one is willing to give me a jump-start, it would
definitely take less time.

Thanks again for all of your help,

Conan


No, it's something that can be used in conjunction with OUtlook VBA. A "run a script" rule action actually uses not an external
script but a VBA procedure with a MailItem or MeetingItem as its parameter. That item is processed by the code:


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

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
MsgBox msg.SUbject

Set msg = Nothing
Set olNS = Nothing
End Sub

See http://www.outlookcode.com/d/code/zaphtml.htm#ol2002 for another example.


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

"Forward" is the wrong action. You'd need to create a new mail message (Application.CreateItem) and build a string from the values of the custom fields, then assign the value of the Body or HTMLBody property of the outgoing item to that string. See http://www.outlookcode.com/d/propsyntax.htm if you don't know how to work with OUtlook properties.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
C

Conan Kelly

Sue,

Thanks again for all of your help,

Conan




"Forward" is the wrong action. You'd need to create a new mail message (Application.CreateItem) and build a string from the values
of the custom fields, then assign the value of the Body or HTMLBody property of the outgoing item to that string. See
http://www.outlookcode.com/d/propsyntax.htm if you don't know how to work with OUtlook properties.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top