|
以下代码可将未读邮件保存到C:\下。 Sub SaveUnreadMail() Dim olApp As New Outlook.Application Dim nmsName As Outlook.NameSpace Dim fldFolder As Outlook.Folder Dim vItem As Object Set nmsName = olApp.GetNamespace("MAPI") Set fldFolder = nmsName.GetDefaultFolder(olFolderInbox) If fldFolder.UnReadItemCount > 0 Then For Each vItem In fldFolder.Items If vItem.UnRead = True Then strname = vItem.Subject strname = Replace(strname, "*", "_") strname = Replace(strname, "\", "_") strname = Replace(strname, "/", "_") strname = Replace(strname, "$", "_") strname = Replace(strname, "%", "_") strname = Replace(strname, "!", "_") strname = Replace(strname, "~", "_") strname = Replace(strname, "(", "_") strname = Replace(strname, ")", "_") strname = Replace(strname, "+", "_") strname = Replace(strname, ":", "_") vItem.SaveAs "C:\" & strname & ".txt", olTXT vItem.UnRead = False End If Next End If End Sub
|
|