PC Review


Reply
Thread Tools Rate Thread

automatic filing of sent outlook 2003 emails by subject title

 
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      13th Jun 2005
I wish to automatically save to disk all sent emails that have a 'code'
within the subject 'title'. This code would route the file to the correct
directory.
If this is a feature of Outlook then I have missed it please could you point
me in the right direction, failing that has anyone done this using a Visual
Basic macro ?
regards

 
Reply With Quote
 
 
 
 
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
 
      14th Jun 2005
Try these macros:

Sub SaveEmailsWithCodeToDisk()
On Error Resume Next

Dim objNS As Outlook.NameSpace
Dim objItems As Outlook.Items
Dim objEmail As Outlook.MailItem
Dim objInbox As Outlook.MAPIFolder
Dim strFileName As String
Dim intX As Integer

Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)

Set objItems = objInbox.Items
For intX = 1 To objItems.Count
If objItems.Item(intX).Class = olMail Then
Set objEmail = objItems.Item(intX)
If InStr(objEmail.Subject, "TEXT OCCURRENCE TO SEARCH FOR") > 0
Then
strFileName = GetValidFileName(objEmail.Subject)
objEmail.SaveAs "C:\Temp\" & strFileName & ".msg", olMSG
End If
End If
Next

Set objNS = Nothing
Set objItems = Nothing
Set objEmail = Nothing
Set objInbox = Nothing
End Sub

Function GetValidFileName(InputString) As String
GetValidFileName = Replace(InputString, ":", "_")
GetValidFileName = Replace(GetValidFileName, "/", "_")
GetValidFileName = Replace(GetValidFileName, "\", "_")
GetValidFileName = Replace(GetValidFileName, "!", "_")
GetValidFileName = Replace(GetValidFileName, "*", "_")
GetValidFileName = Replace(GetValidFileName, "?", "_")
GetValidFileName = Replace(GetValidFileName, ";", "_")
GetValidFileName = Replace(GetValidFileName, "<", "_")
GetValidFileName = Replace(GetValidFileName, ">", "_")
GetValidFileName = Replace(GetValidFileName, "|", "_")
GetValidFileName = Replace(GetValidFileName, """", "_")
End Function

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
Try Picture Attachments Wizard for Outlook! http://tinyurl.com/9bby8
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/


"Mike" wrote:

> I wish to automatically save to disk all sent emails that have a 'code'
> within the subject 'title'. This code would route the file to the correct
> directory.
> If this is a feature of Outlook then I have missed it please could you point
> me in the right direction, failing that has anyone done this using a Visual
> Basic macro ?
> regards
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2003 saved drafts lose format, subject title resonator80 Microsoft Outlook 0 13th Sep 2010 04:31 PM
Outlook 2003 saved drafts lose format, subject title resonator80 Microsoft Outlook Discussion 0 13th Sep 2010 04:31 PM
Automatic Emails in Outlook 2003 tlc247 Microsoft Outlook Discussion 1 11th Jul 2008 02:23 PM
Automatic response to emails based on words in subject or body =?Utf-8?B?RXJpbg==?= Microsoft Outlook Form Programming 3 28th Oct 2007 12:55 PM
Automatic emails outlook 2003 =?Utf-8?B?bmljY29sZW0=?= Microsoft Outlook VBA Programming 1 19th Apr 2005 05:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:07 PM.