A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How can I save specific emails to d:\email as a .txt file?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 6th 06, 04:59 PM posted to microsoft.public.outlook.program_vba
sthana
external usenet poster
 
Posts: 1
Default How can I save specific emails to d:\email as a .txt file?

I need to save emails from a particular email address which has "GG123456" in
the email message as a txt file onto a my local hard disk drive. These emails
have to be saved as they arrive. I have looked at message rules but cannot
figure out how to save the message as a .txt file. Any help would be
appreciated. Thanks

Ste
Ads
  #2  
Old December 7th 06, 07:32 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How can I save specific emails to d:\email as a .txt file?



You could use a run-a-script-rule that looks for specific words in the
message body and then calls your script. That script could look like this:

Public Sub SaveToFile(Mail as Outlook.MailItem)
Dim Name as String

Name=Mail.Subject
ReplaceCharsForFileName Name, "_"
Mail.SaveAs "d:\" & Name & ".txt",olTXT
End Sub


Private Sub ReplaceCharsForFileName(sName As String, _
sChr As String _
)
' Replaces characters which aren't allowed for file names
sName = Replace(sName, "/", sChr)
sName = Replace(sName, "\", sChr)
sName = Replace(sName, ":", sChr)
sName = Replace(sName, "?", sChr)
sName = Replace(sName, Chr(34), sChr)
sName = Replace(sName, "", sChr)
sName = Replace(sName, "", sChr)
sName = Replace(sName, "|", sChr)
End Sub

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

Am Wed, 6 Dec 2006 07:59:01 -0800 schrieb sthana:

I need to save emails from a particular email address which has "GG123456"

in
the email message as a txt file onto a my local hard disk drive. These

emails
have to be saved as they arrive. I have looked at message rules but cannot
figure out how to save the message as a .txt file. Any help would be
appreciated. Thanks

Ste

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
outlook 2k3 Script: how to Save Mail body to txt file news.microsoft.com Outlook and VBA 5 November 7th 06 03:23 PM
How to extract multiple MIME/base64 inline parts from a *.txt file ? Tobias Merler Outlook - General Queries 0 September 5th 06 03:09 PM
Saving an email in .txt file Maggie Helton Outlook and VBA 1 August 23rd 06 06:54 AM
How to attach .txt file to all outgoing emails? [email protected] Outlook - General Queries 1 August 17th 06 04:22 PM
last string in txt file Leech Outlook and VBA 1 February 10th 06 08:13 AM


All times are GMT +1. The time now is 10:41 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.