得罪拉,道个谦。
在Outlook -> Tools -> Macros -> VB Editor 里面run, 又加了几行文件操作
Sub TraverseMail()
Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim intFile As Integer
Dim Subject, From As String
Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
intFile = FreeFile
If Inbox.Items.Count > 0 Then
Open "C:\Temp\Test.txt" For Output As intFile
For Each Item In Inbox.Items
If Item <> Null Then
Subject = Item.Subject
From = Item.SenderName
Print #intFile, Subject + " @ " + From ' append content to a file
End If
Next Item
Close intFile
Else
MsgBox "There is no message in the box."
End If
End Sub
在Outlook -> Tools -> Macros -> VB Editor 里面run, 又加了几行文件操作
Sub TraverseMail()
Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim intFile As Integer
Dim Subject, From As String
Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
intFile = FreeFile
If Inbox.Items.Count > 0 Then
Open "C:\Temp\Test.txt" For Output As intFile
For Each Item In Inbox.Items
If Item <> Null Then
Subject = Item.Subject
From = Item.SenderName
Print #intFile, Subject + " @ " + From ' append content to a file
End If
Next Item
Close intFile
Else
MsgBox "There is no message in the box."
End If
End Sub