![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 "Sue Mosher [MVP-Outlook]" wrote: 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. -- 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 "Glenn Harless" wrote in message ... 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Script to forward e-mail to address in Subject line | [email protected] | Outlook and VBA | 2 | September 7th 06 01:45 PM |
Font color/style change-ability w/in event window subject line | Trish T | Outlook - Calandaring | 0 | August 24th 06 07:18 PM |
How do I change the font in the subject line of an appointment | kristilynn777 | Outlook - Calandaring | 1 | May 24th 06 05:28 AM |
Mail merge Contacts fields into subject line of email | TheScenicRoute | Outlook - Using Contacts | 5 | April 14th 06 02:02 PM |
Change email subject line... | silas | Outlook Express | 1 | February 27th 06 11:59 PM |