码迷,mamicode.com
首页 > 编程语言 > 详细

用 OUTLOOK VBA 生成 自定义文件夹 邮件列表

时间:2015-07-23 19:40:02      阅读:331      评论:0      收藏:0      [点我收藏+]

标签:

Option Explicit

Sub TestFolder()
Dim outlookapp, myitem, myfolderDim mailcounts As Integer
‘
‘
‘Set outlookapp = CreateObject("outlook.application")    Set myitem = outlookapp.Application.GetNamespace("mapi")    Set myfolder = myitem.GetDefaultFolder(olFolderInbox).Folders("AnualParty15")    mailcounts = myfolder.Items.Count
‘
‘    Debug.Print mailcounts

Dim mobjOutlook As Outlook.NameSpace
Dim objOutlook As New Outlook.Application
Dim objFolder As Outlook.Folder

Set mobjOutlook = objOutlook.GetNamespace("MAPI")
Set objFolder = mobjOutlook.GetDefaultFolder(olFolderInbox).Folders("AnualParty15")

Dim objMail As Outlook.MailItem

For Each objMail In objFolder.Items
    Debug.Print objMail.SenderEmailAddress, objMail.Sender, objMail.Subject, objMail.ReceivedTime
Next
    
End Sub

 

用 OUTLOOK VBA 生成 自定义文件夹 邮件列表

标签:

原文地址:http://www.cnblogs.com/jiceberg420/p/4671054.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!