title: Save outlook mail into individual .txt files in to system folder
body: <p>I tried to save Outlook mail to a system folder in .txt format. After running the macro I am not able to see any files in the system folder.</p>
  
  <p>I am not getting any result in the I:\Documents folder.</p>
  
  <pre><code>Sub SaveSelectedMailAsTxtFile()
    Const OLTXT = 0
    Dim currentExplorer As Explorer
    Dim Selection As Selection
    Dim oMail As Outlook.MailItem
    Dim obj As Object
    Dim sPath As String
    Dim dtDate As Date
    Dim sName As String
  
    Set currentExplorer = Application.ActiveExplorer
    Set Selection = currentExplorer.Selection
  
    For Each obj In Selection
      Set oMail = obj
      sName = oMail.Subject
      ReplaceCharsForFileName sName, "_"
  
      dtDate = oMail.ReceivedTime
      sName = Format(dtDate, "yyyymmdd", vbUseSystemDayOfWeek, _
        vbUseSystem) &amp; Format(dtDate, "-hhnnss", _
        vbUseSystemDayOfWeek, vbUseSystem) &amp; "-" &amp; sName &amp; ".txt"
  
      oMail.SaveAs "I:\Documents" &amp; sName &amp; ".txt", OLTXT
    Next
  
  End Sub
  
  Private Sub ReplaceCharsForFileName(sName As String, sChr As String)
    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, "&lt;", sChr)
    sName = Replace(sName, "&gt;", sChr)
    sName = Replace(sName, "|", sChr)
  End Sub
  </code></pre>