将outlook中的邮件批量导出为txt

时间:2024-03-05 20:46:01

Public Sub SaveAsTXT()

 

    Dim msg As MailItem

    Dim exp As Explorer

    Dim path As String

    Dim folder As String

    Dim dt As String

 

 

 

 

 

    Set exp = Application.ActiveExplorer

 

    folder = "C:\Users\yzhen22\R9\"

 

    For Each msg In exp.Selection

 

            dt = Format(msg.ReceivedTime, "yyyy-mm-dd")

 

            msg.SaveAs folder & dt & ".txt", olTXT

            Next

 

 

 

 

End Sub