vba读取邮件标题
展开全部
试试下面的代码:
Sub 导入邮件()
On Error Resume Next
Dim olApp As New Outlook.Application, olNameSpace As Outlook.Namespace
Dim olMailItem As Outlook.MailItem, olFolder As Outlook.Folder
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olFolder = olNameSpace.GetDefaultFolder(olFolderInbox) '收件箱
For i = 1 To olFolder.Items.Count
Set olMailItem = olFolder.Items(i) '获取一个邮件项目
With olMailItem
ActiveSheet.Cells(i + 2, 1) = IIf(.UnRead, "未读", "已读") '状态
ActiveSheet.Cells(i + 2, 2) = .SenderName & "(" & .SenderEmailAddress & ")" '发件人
ActiveSheet.Cells(i + 2, 3) = .Subject '主题
ActiveSheet.Cells(i + 2, 4) = .ReceivedTime '主题
End With
Next
End Sub
展开全部
Sub 导入邮件()
On Error Resume Next
Dim olApp As New Outlook.Application, olNameSpace As Outlook.Namespace
Dim olMailItem As Outlook.MailItem, olFolder As Outlook.Folder
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olFolder = olNameSpace.GetDefaultFolder(olFolderInbox) '收件箱
For i = 1 To olFolder.Items.Count
Set olMailItem = olFolder.Items(i) '获取一个邮件项目
With olMailItem
ActiveSheet.Cells(i + 2, 1) = IIf(.UnRead, "未读", "已读") '状态
ActiveSheet.Cells(i + 2, 2) = .SenderName & "(" & .SenderEmailAddress & ")" '发件人
ActiveSheet.Cells(i + 2, 3) = .Subject '主题
ActiveSheet.Cells(i + 2, 4) = .ReceivedTime '主题
End With
Next
End Sub
On Error Resume Next
Dim olApp As New Outlook.Application, olNameSpace As Outlook.Namespace
Dim olMailItem As Outlook.MailItem, olFolder As Outlook.Folder
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olFolder = olNameSpace.GetDefaultFolder(olFolderInbox) '收件箱
For i = 1 To olFolder.Items.Count
Set olMailItem = olFolder.Items(i) '获取一个邮件项目
With olMailItem
ActiveSheet.Cells(i + 2, 1) = IIf(.UnRead, "未读", "已读") '状态
ActiveSheet.Cells(i + 2, 2) = .SenderName & "(" & .SenderEmailAddress & ")" '发件人
ActiveSheet.Cells(i + 2, 3) = .Subject '主题
ActiveSheet.Cells(i + 2, 4) = .ReceivedTime '主题
End With
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以的,批量发送邮件,html表格都可以
更多追问追答
追问
并不是要发送。而是把收到的邮件的邮件标题拿出来
追答
可以的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
写好了啊。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |