Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Save incoming Email as .html file with name of subject line (http://www.outlookbanter.com/outlook-vba/102716-save-incoming-email-html-file.html)

Matt May 22nd 10 02:00 PM

Save incoming Email as .html file with name of subject line
 
Hello all!

I am using the below code to save all incoming emails as an XML file. The
problem is that a new incoming email overwrites the previous one. What I'd
like to do is name the XML file as the subject line of the incoming email.
Would someone please help me?

Sub saveemail(myItem As Outlook.MailItem)
myItem.SaveAs "c:\mail\test.XML", olXML
End Sub

Matt


Matt May 22nd 10 03:29 PM

Save incoming Email as .html file with name of subject line
 
Never mind...... I was able to do it. In case anyone else need to know how:

Sub saveemail(myItem As Outlook.MailItem)
myItem.SaveAs "c:\mail\" & myItem.Subject & ".xml", olXML
End Sub

Thanks All!

"Matt" wrote:

Hello all!

I am using the below code to save all incoming emails as an XML file. The
problem is that a new incoming email overwrites the previous one. What I'd
like to do is name the XML file as the subject line of the incoming email.
Would someone please help me?

Sub saveemail(myItem As Outlook.MailItem)
myItem.SaveAs "c:\mail\test.XML", olXML
End Sub

Matt


Chris May 27th 10 09:27 PM

Save incoming Email as .html file with name of subject line
 
Matt:

You might want to add either ReceivedTime(Emails) or CreationTime(Reports)

Yoru code would look like:
myItem.SaveAs "c:\mail\" & myItem.Subject & "_" & myItem.ReceivedTime &
".xml", olXML

As I have discovered, you may need to scrub the subject and time of any
illegal characters such as "/", ":", or "*" etc.

Chris

"Matt" wrote:

Never mind...... I was able to do it. In case anyone else need to know how:

Sub saveemail(myItem As Outlook.MailItem)
myItem.SaveAs "c:\mail\" & myItem.Subject & ".xml", olXML
End Sub

Thanks All!

"Matt" wrote:

Hello all!

I am using the below code to save all incoming emails as an XML file. The
problem is that a new incoming email overwrites the previous one. What I'd
like to do is name the XML file as the subject line of the incoming email.
Would someone please help me?

Sub saveemail(myItem As Outlook.MailItem)
myItem.SaveAs "c:\mail\test.XML", olXML
End Sub

Matt


Matt May 27th 10 10:47 PM

Save incoming Email as .html file with name of subject line
 
Hey Chris,

Good Idea!

Thanks

Matt

"Chris" wrote:

Matt:

You might want to add either ReceivedTime(Emails) or CreationTime(Reports)

Yoru code would look like:
myItem.SaveAs "c:\mail\" & myItem.Subject & "_" & myItem.ReceivedTime &
".xml", olXML

As I have discovered, you may need to scrub the subject and time of any
illegal characters such as "/", ":", or "*" etc.

Chris

"Matt" wrote:

Never mind...... I was able to do it. In case anyone else need to know how:

Sub saveemail(myItem As Outlook.MailItem)
myItem.SaveAs "c:\mail\" & myItem.Subject & ".xml", olXML
End Sub

Thanks All!

"Matt" wrote:

Hello all!

I am using the below code to save all incoming emails as an XML file. The
problem is that a new incoming email overwrites the previous one. What I'd
like to do is name the XML file as the subject line of the incoming email.
Would someone please help me?

Sub saveemail(myItem As Outlook.MailItem)
myItem.SaveAs "c:\mail\test.XML", olXML
End Sub

Matt



All times are GMT +1. The time now is 05:03 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-2006 OutlookBanter.com