One way is to use a "run a script" rule, a Rules Wizard action that invokes a VBA procedure with a MailItem or MeetingItem as its parameter, then uses that item in the code:
Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
olMail.SUbject = "whatever you want the subject to be"
olMaIl.Save
Set olMail = Nothing
Set olNS = Nothing
End Sub
See http://www.outlookcode.com/d/code/zaphtml.htm#ol2002 for another example.

Signature
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
>I wish to create a script to alter the subject line of incoming mail to
> remove certain character strings.
>
> Google has not been much help...any suggestions or guidence is appreciatied
Glenn Harless - 11 Nov 2005 17:50 GMT
Thanks Sue. I'll give it a shot
D-Man - 29 Jan 2007 16:01 GMT
Good Morning Sue,
I am new to scripting in VBA but I have done some vbs scripting. We receive
about 25,000 faxes and they are sent to an Outlook Mailbox. The subject of
the e-mails contain the senders fax number. We would like to have a rule
change the fax number to the customers name when the e-mail arrives. I tried
your code below with the changes below but I am unable to get it to work.
Would you be so kind as to help me through this?
Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
If olMail.Subject = "555-1212" Then
olMail.Subject = "New Customer"
olMail.Save
End If
Set olMail = Nothing
Set olNS = Nothing
End Sub
Thanks In advance
> One way is to use a "run a script" rule, a Rules Wizard action that invokes a VBA procedure with a MailItem or MeetingItem as its parameter, then uses that item in the code:
>
[quoted text clipped - 20 lines]
> >
> > Google has not been much help...any suggestions or guidence is appreciatied
Sue Mosher [MVP-Outlook] - 29 Jan 2007 16:26 GMT
What in particular doesn't work? Did you check the VBA basics at http://www.outlookcode.com/d/vbabasics.htm?

Signature
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
> Good Morning Sue,
>
[quoted text clipped - 49 lines]
>> >
>> > Google has not been much help...any suggestions or guidence is appreciatied
D-Man - 29 Jan 2007 17:06 GMT
I did go through that document. Could the problem be that if the faxes are
not going to the default inbox but rather than another user account mailbox?
Do I need to make changes in the script to reflect that?
Thanks in advance.
> What in particular doesn't work? Did you check the VBA basics at http://www.outlookcode.com/d/vbabasics.htm?
>
[quoted text clipped - 51 lines]
> >> >
> >> > Google has not been much help...any suggestions or guidence is appreciatied
Sue Mosher [MVP-Outlook] - 29 Jan 2007 19:12 GMT
The code you cited works with an Outlook rule, which means it affects only messages coming into your own mailbox. To handle items in another mailbox with Outlook code, you would have to leave a machine running 24/7 and use a different coding approach -- the MAPIFolder.Items.ItemAdd event.

Signature
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
>I did go through that document. Could the problem be that if the faxes are
> not going to the default inbox but rather than another user account mailbox?
[quoted text clipped - 52 lines]
>> >>
>> >> See http://www.outlookcode.com/d/code/zaphtml.htm#ol2002 for another example.
>> >> >I wish to create a script to alter the subject line of incoming mail to
>> >> > remove certain character strings.
>> >> >
>> >> > Google has not been much help...any suggestions or guidence is appreciatied